Exemple #1
0
        internal bool ProcessKeyDown(FooTextBox textbox, KeyEventArgs e, bool isCtrl, bool isShift)
        {
            if (this.IsCloseCompleteBox)
            {
                if (e.KeyCode == Keys.Space && isCtrl)
                {
                    this.isReqForceComplete = true;
                    return(true);
                }
                return(false);
            }

            switch (e.KeyCode)
            {
            case Keys.Escape:
                this.RequestCloseCompleteBox();
                textbox.Focus();
                return(true);

            case Keys.Down:
                if (this.listBox1.SelectedIndex + 1 >= this.listBox1.Items.Count)
                {
                    this.listBox1.SelectedIndex = this.listBox1.Items.Count - 1;
                }
                else
                {
                    this.listBox1.SelectedIndex++;
                }
                return(true);

            case Keys.Up:
                if (this.listBox1.SelectedIndex - 1 < 0)
                {
                    this.listBox1.SelectedIndex = 0;
                }
                else
                {
                    this.listBox1.SelectedIndex--;
                }
                return(true);

            case Keys.Tab:
                this.RequestCloseCompleteBox();
                CompleteWord selWord = (CompleteWord)this.listBox1.SelectedItem;
                this.SelectItem(this, new SelectItemEventArgs(selWord, this.inputedWord, this.Document));
                textbox.Refresh();
                return(true);
            }

            return(false);
        }
Exemple #2
0
 internal bool ProcessKeyPress(FooTextBox textbox, KeyPressEventArgs e)
 {
     if (this.isReqForceComplete && e.KeyChar == ' ')
     {
         this.OpenCompleteBox(string.Empty);
         return(true);
     }
     else if (!this.IsCloseCompleteBox && (e.KeyChar == '\r'))
     {
         this.RequestCloseCompleteBox();
         CompleteWord selWord = (CompleteWord)this.listBox1.SelectedItem;
         this.SelectItem(this, new SelectItemEventArgs(selWord, this.inputedWord, this.Document));
         textbox.Refresh();
         return(true);
     }
     return(false);
 }