SetFirstFocusItem() public method

Set focus to the first focus item inside the popup group.
public SetFirstFocusItem ( ) : void
return void
Example #1
0
        private void KeyDownPopupMinimized(VisualPopupMinimized popupMinimized, KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.Tab | Keys.Shift:
            case Keys.Left:
                popupMinimized.SetPreviousFocusItem();
                break;

            case Keys.Tab:
            case Keys.Right:
                popupMinimized.SetNextFocusItem();
                break;

            case Keys.Space:
            case Keys.Enter:
                OnClick(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));

                // Get access to the popup for the group
                if ((VisualPopupManager.Singleton.CurrentPopup != null) &&
                    (VisualPopupManager.Singleton.CurrentPopup is VisualPopupGroup))
                {
                    // Cast to correct type
                    VisualPopupGroup popupGroup = (VisualPopupGroup)VisualPopupManager.Singleton.CurrentPopup;
                    popupGroup.SetFirstFocusItem();
                }
                break;
            }
        }
Example #2
0
        private void KeyDownRibbon(KryptonRibbon ribbon, KeyEventArgs e)
        {
            ViewBase newView = null;

            switch (e.KeyData)
            {
            case Keys.Tab | Keys.Shift:
            case Keys.Left:
                // Get the previous focus item for the currently selected page
                newView = ribbon.GroupsArea.ViewGroups.GetPreviousFocusItem(_target) ?? ribbon.TabsArea.LayoutTabs.GetViewForRibbonTab(ribbon.SelectedTab);

                // Got to the actual tab header
                break;

            case Keys.Tab:
            case Keys.Right:
                // Get the next focus item for the currently selected page
                newView = ribbon.GroupsArea.ViewGroups.GetNextFocusItem(_target) ?? ribbon.TabsArea.ButtonSpecManager.GetFirstVisibleViewButton(PaletteRelativeEdgeAlign.Far);

                // Move across to any far defined buttons

                // Move across to any inherit defined buttons
                if (newView == null)
                {
                    newView = ribbon.TabsArea.ButtonSpecManager.GetFirstVisibleViewButton(PaletteRelativeEdgeAlign.Inherit);
                }

                // Rotate around to application button
                if (newView == null)
                {
                    if (ribbon.TabsArea.LayoutAppButton.Visible)
                    {
                        newView = ribbon.TabsArea.LayoutAppButton.AppButton;
                    }
                    else if (ribbon.TabsArea.LayoutAppTab.Visible)
                    {
                        newView = ribbon.TabsArea.LayoutAppTab.AppTab;
                    }
                }
                break;

            case Keys.Space:
            case Keys.Enter:
                OnClick(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));

                // Get access to the popup for the group
                if ((VisualPopupManager.Singleton.CurrentPopup != null) &&
                    (VisualPopupManager.Singleton.CurrentPopup is VisualPopupGroup))
                {
                    // Cast to correct type
                    VisualPopupGroup popupGroup = (VisualPopupGroup)VisualPopupManager.Singleton.CurrentPopup;
                    popupGroup.SetFirstFocusItem();
                }
                break;
            }

            // If we have a new view to focus and it is not ourself...
            if ((newView != null) && (newView != _target))
            {
                // If the new view is a tab then select that tab unless in minimized mode
                if (!ribbon.RealMinimizedMode && (newView is ViewDrawRibbonTab tab))
                {
                    ribbon.SelectedTab = tab.RibbonTab;
                }

                // Finally we switch focus to new view
                ribbon.FocusView = newView;
            }
        }