OnTabPressed() private method

Handler for tab selection.
private OnTabPressed ( Control control ) : void
control Control Event source (TabButton).
return void
Example #1
0
        /// <summary>
        /// Handler for Left Arrow keyboard event.
        /// </summary>
        /// <param name="down">Indicates whether the key was pressed or released.</param>
        /// <returns>
        /// True if handled.
        /// </returns>
        protected override bool OnKeyLeft(bool down)
        {
            if (down)
            {
                var count = Parent.Children.Count;
                int me    = Parent.Children.IndexOf(this);
                if (me - 1 >= 0)
                {
                    var prevTab = Parent.Children[me - 1];
                    TabControl.OnTabPressed(prevTab);
                    InputHandler.KeyboardFocus = prevTab;
                }
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Handler for Right Arrow keyboard event.
        /// </summary>
        /// <param name="down">Indicates whether the key was pressed or released.</param>
        /// <returns>
        /// True if handled.
        /// </returns>
        protected override bool OnKeyRight(bool down)
        {
            if (down)
            {
                var count = Parent.Children.Count;
                int me    = Parent.Children.IndexOf(this);
                if (me + 1 < count)
                {
                    var nextTab = Parent.Children[me + 1];
                    TabControl.OnTabPressed(nextTab);
                    InputHandler.KeyboardFocus = nextTab;
                }
            }

            return(true);
        }