Esempio n. 1
0
        /// <summary>
        /// Searches for a next block "deep"
        /// (includes children of following blocks recursively)
        /// </summary>
        /// <returns></returns>
        public Block FindNextFocusableBlock()
        {
            Block current = this.Next;

            while (current != null)
            {
                Block foundFocusableBlock = current.FindFirstFocusableBlock();
                if (foundFocusableBlock != null)
                {
                    return(foundFocusableBlock);
                }
                current = current.Next;
            }

            return(null);
        }
Esempio n. 2
0
        protected override void Children_KeyDown(Block block, System.Windows.Forms.KeyEventArgs e)
        {
            Block nextFocusable = null;

            if (e.KeyCode == System.Windows.Forms.Keys.Home)
            {
                nextFocusable = this.FindFirstFocusableBlock();
                if (nextFocusable != null)
                {
                    nextFocusable.SetCursorToTheBeginning();
                    e.Handled = true;
                }
            }
            else if (e.KeyCode == System.Windows.Forms.Keys.End)
            {
                nextFocusable = this.FindLastFocusableChild();
                if (nextFocusable != null)
                {
                    nextFocusable.SetCursorToTheEnd();
                    e.Handled = true;
                }
            }
            else if (e.KeyCode == System.Windows.Forms.Keys.Return)
            {
                Block next = this.Next;
                if (next != null)
                {
                    nextFocusable = next.FindFirstFocusableBlock();
                    if (nextFocusable == null)
                    {
                        nextFocusable = nextFocusable.FindNextFocusableBlock();
                    }
                    if (nextFocusable != null)
                    {
                        nextFocusable.SetFocus();
                        e.Handled = true;
                    }
                }
            }

            if (!e.Handled)
            {
                base.Children_KeyDown(block, e);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Searches for a next block "deep"
        /// (includes children of following blocks recursively)
        /// </summary>
        /// <returns></returns>
        public Block FindNextFocusableBlockInChain()
        {
            Block current = this.Next;

            while (current != null)
            {
                Block foundFocusableBlock = current.FindFirstFocusableBlock();
                if (foundFocusableBlock != null && foundFocusableBlock.CanGetFocus)
                {
                    return(foundFocusableBlock);
                }
                current = current.Next;
            }

            if (this.Parent != null)
            {
                return(this.Parent.FindNextFocusableBlockInChain());
            }

            return(null);
        }