Ejemplo n.º 1
0
        /// <inheritdoc cref="GLOFC.GL4.Controls.GLBaseControl.OnKeyDown(GLKeyEventArgs)"/>
        protected override void OnKeyDown(GLKeyEventArgs e)       // forms gets first dibs at keys of children
        {
            base.OnKeyDown(e);
            //System.Diagnostics.Debug.WriteLine("Form key " + e.KeyCode);
            if (!e.Handled && TabChangesFocus && e.KeyCode == System.Windows.Forms.Keys.Tab)
            {
                bool          forward = e.Shift == false;
                GLBaseControl next    = FindNextTabChild(lastchildfocus?.TabOrder ?? -1, forward);
                if (next == null)
                {
                    next = FindNextTabChild(forward ?-1 : int.MaxValue, forward);
                }
                if (next != null)
                {
                    lastchildfocus = next;
                    next.SetFocus();
                }

                e.Handled = true;
            }
        }