Пример #1
0
        public override bool OnKeyboardEvent(KeyboardEvent keyboardevent)
        {
            Element2D element2D = ChildList.Last();

            if (element2D != null)
            {
                return(element2D.OnKeyboardEvent(keyboardevent));
            }

            return(false);
        }
Пример #2
0
        public void OnKeyboardEvent(KeyboardEvent keyboardevent)
        {
            if (keyboardevent.Tab)
            {
                var tabIndexElements = new List <Element2D>();
                m_oframeRootMasterElement.GetNextTabIndexElement(ref tabIndexElements);
                var num1 = -1;
                foreach (Element2D element2D in tabIndexElements)
                {
                    if (element2D.tabIndex > num1)
                    {
                        num1 = element2D.tabIndex;
                    }
                }
                var num2       = -1;
                var element2D1 = (Element2D)null;
                if (m_oeFocusElement != null)
                {
                    element2D1 = m_oeFocusElement;
                    num2       = m_oeFocusElement.tabIndex;
                }
                var num3 = -1;
                foreach (Element2D element2D2 in tabIndexElements)
                {
                    if (element2D2.tabIndex != num2)
                    {
                        if (element2D2.tabIndex < num2)
                        {
                            if (num1 - num2 + element2D2.tabIndex < num3 || num3 == -1)
                            {
                                m_oeFocusElement = element2D2;
                                num3             = num1 - num2 + element2D2.tabIndex;
                            }
                        }
                        else if (element2D2.tabIndex - num2 < num3 || num3 == -1)
                        {
                            m_oeFocusElement = element2D2;
                            num3             = element2D2.tabIndex - num2;
                        }
                    }
                }
                if (element2D1 != null)
                {
                    element2D1.HasFocus = false;
                }

                if (m_ocbComboboxSelected != null)
                {
                    m_ocbComboboxSelected.ShowDropDown = false;
                }

                m_oeFocusElement.HasFocus = true;
                if (m_oeFocusElement.GetElementType() == ElementType.ComboBoxWidget)
                {
                    m_ocbComboboxSelected = (ComboBoxWidget)m_oeFocusElement;
                }
                else
                {
                    m_ocbComboboxSelected = null;
                }
            }
            else if (keyboardevent.Type == KeyboardEventType.CommandKey && ((CommandKeyEvent)keyboardevent).Key == KeyboardCommandKey.Escape)
            {
                m_oframeRootMasterElement.OnKeyboardEvent(keyboardevent);
            }
            else if (m_oeFocusElement != null)
            {
                if (m_ocbComboboxSelected != null)
                {
                    m_ocbComboboxSelected.OnKeyboardEvent(keyboardevent);
                }
                else if (m_oeFocusElement.IsListBoxElement())
                {
                    ListBoxWidget listBoxElement = m_oeFocusElement.GetListBoxElement();
                    if (listBoxElement == null)
                    {
                        return;
                    }

                    listBoxElement.HasFocus = true;
                    listBoxElement.OnKeyboardEvent(keyboardevent);
                    listBoxElement.HasFocus = false;
                }
                else
                {
                    m_oeFocusElement.OnKeyboardEvent(keyboardevent);
                }
            }
            else
            {
                m_oframeRootMasterElement.OnKeyboardEvent(keyboardevent);
            }
        }