示例#1
0
 public override GuiLabs.Canvas.Controls.Control DefaultFocusableControl()
 {
     if (string.IsNullOrEmpty(NameBlock.Text))
     {
         return(NameBlock.DefaultFocusableControl());
     }
     //return Attributes.DefaultFocusableControl();
     return(VMembers.DefaultFocusableControl());
 }
示例#2
0
        protected override void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            Block nextFocusable = null;

            if (IsMoveUpDown(e))
            {
                e.Handled = true;
                return;
            }

            switch (e.KeyCode)
            {
            case System.Windows.Forms.Keys.Right:
                nextFocusable = this.FindFirstFocusableChild();
                if (nextFocusable == null)
                {
                    nextFocusable = this.FindNextFocusableBlockInChain();
                }
                nextFocusable.SetCursorToTheBeginning();
                e.Handled = true;
                return;

            case System.Windows.Forms.Keys.Down:
                if (VMembers.Visible &&
                    this.MyUniversalControl.LinearLayoutStrategy.Orientation == OrientationType.Vertical)
                {
                    nextFocusable = VMembers.FindFirstFocusableBlock();
                    if (nextFocusable != null)
                    {
                        nextFocusable.SetFocus();
                        e.Handled = true;
                        return;
                    }
                }
                break;

            case System.Windows.Forms.Keys.End:
                nextFocusable = HMembers.FindLastFocusableBlock();
                if (nextFocusable != null)
                {
                    nextFocusable.SetCursorToTheEnd();
                    e.Handled = true;
                    return;
                }
                break;

            default:
                break;
            }

            if (nextFocusable != null && nextFocusable.CanGetFocus)
            {
                nextFocusable.SetFocus();
                e.Handled = true;
            }

            if (!e.Handled)
            {
                base.OnKeyDown(sender, e);
            }
        }
示例#3
0
        protected override void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            Block nextFocusable = null;

            switch (e.KeyCode)
            {
            case System.Windows.Forms.Keys.Left:
                if (!this.MyControl.Collapsed && this.VMembers.Children.Count > 0)
                {
                    e.Handled = true;
                    this.MyNodeControl.ToggleCollapse(true);
                }
                break;

            case System.Windows.Forms.Keys.Right:
                if (this.MyControl.Collapsed)
                {
                    e.Handled = true;
                    this.MyNodeControl.ToggleCollapse(true);
                }
                else
                {
                    nextFocusable = VMembers.FindFirstFocusableBlock();
                }
                break;

            case System.Windows.Forms.Keys.Down:
                if (VMembers.MyControl.Visible && !VMembers.MyControl.Collapsed)
                {
                    nextFocusable = VMembers.FindFirstFocusableBlock();
                }
                break;

            case System.Windows.Forms.Keys.End:
                nextFocusable = HMembers.FindLastFocusableBlock();
                break;

            case System.Windows.Forms.Keys.Add:
                if (this.MyControl.Collapsed)
                {
                    e.Handled = true;
                    this.MyNodeControl.ToggleCollapse(true);
                }
                break;

            case System.Windows.Forms.Keys.Subtract:
                if (!this.MyControl.Collapsed && this.VMembers.Children.Count > 0)
                {
                    e.Handled = true;
                    this.MyNodeControl.ToggleCollapse(true);
                }
                break;

            case System.Windows.Forms.Keys.Space:
                e.Handled = true;
                this.MyNodeControl.ToggleCollapse(true);
                break;

            case System.Windows.Forms.Keys.Multiply:
                e.Handled = true;
                this.MyNodeControl.CollapseAll(false, true);
                break;

            case System.Windows.Forms.Keys.Divide:
                e.Handled = true;
                this.MyNodeControl.CollapseAll(true, true);
                break;

            case System.Windows.Forms.Keys.Delete:
                this.Delete();
                e.Handled = true;
                break;

            default:
                break;
            }

            if (nextFocusable != null && nextFocusable.CanGetFocus)
            {
                nextFocusable.SetFocus();
                e.Handled = true;
            }

            RaiseKeyDown(e);
        }