ZForge.Controls.ExplorerBar.Expando.ProcessArrowKey C# (CSharp) Method

ProcessArrowKey() protected method

Selects the next available control and makes it the active control
protected ProcessArrowKey ( bool forward ) : bool
forward bool true to cycle forward through the controls in /// the Expando; otherwise, false
return bool
        protected virtual bool ProcessArrowKey(bool forward)
        {
            if (forward)
            {
                if (this.Focused && !this.Collapsed)
                {
                    return base.SelectNextControl(this, forward, true, true, false);
                }
                else if ((this.Items.Count > 0 && this.Items[this.Items.Count-1].Focused) || this.Collapsed)
                {
                    int index = this.TaskPane.Expandos.IndexOf(this);

                    if (index < this.TaskPane.Expandos.Count-1)
                    {
                        this.TaskPane.Expandos[index+1].Select();

                        return this.TaskPane.Expandos[index+1].Focused;
                    }
                    else
                    {
                        return true;
                    }
                }
            }
            else
            {
                if (this.Focused)
                {
                    int index = this.TaskPane.Expandos.IndexOf(this);

                    if (index > 0)
                    {
                        return this.Parent.SelectNextControl(this, forward, true, true, false);
                    }
                    else
                    {
                        return true;
                    }
                }
                else if (this.Items.Count > 0)
                {
                    if (this.Items[0].Focused)
                    {
                        this.Select();

                        return this.Focused;
                    }
                    else
                    {
                        return this.Parent.SelectNextControl(this.FindFocusedChild(), forward, true, true, false);
                    }
                }
            }

            return false;
        }