Exemplo n.º 1
0
        private void listBox1_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            this.popup.IsOpen = false;
            CompleteWord selWord = (CompleteWord)this.listBox1.SelectedItem;

            this.SelectItem(this, new SelectItemEventArgs(selWord, this.inputedWord, this.Document));
        }
Exemplo n.º 2
0
        internal bool ProcessKeyDown(FooTextBox textbox, KeyEventArgs e, bool isCtrl, bool isShift)
        {
            if (this.popup.IsOpen == false)
            {
                if (e.Key == Key.Space && isCtrl)
                {
                    this.OpenCompleteBox(string.Empty);
                    e.Handled = true;

                    return(true);
                }
                return(false);
            }

            switch (e.Key)
            {
            case Key.Escape:
                this.RequestCloseCompleteBox();
                textbox.Focus();
                e.Handled = true;
                return(true);

            case Key.Down:
                if (this.listBox1.SelectedIndex + 1 >= this.listBox1.Items.Count)
                {
                    this.listBox1.SelectedIndex = this.listBox1.Items.Count - 1;
                }
                else
                {
                    this.listBox1.SelectedIndex++;
                }
                this.listBox1.ScrollIntoView(this.listBox1.SelectedItem);
                e.Handled = true;
                return(true);

            case Key.Up:
                if (this.listBox1.SelectedIndex - 1 < 0)
                {
                    this.listBox1.SelectedIndex = 0;
                }
                else
                {
                    this.listBox1.SelectedIndex--;
                }
                this.listBox1.ScrollIntoView(this.listBox1.SelectedItem);
                e.Handled = true;
                return(true);

            case Key.Tab:
            case Key.Enter:
                this.RequestCloseCompleteBox();
                CompleteWord selWord = (CompleteWord)this.listBox1.SelectedItem;
                this.SelectItem(this, new SelectItemEventArgs(selWord, this.inputedWord, this.Document));
                e.Handled = true;
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public void CanComplete_WhenSuppliedWithInputAndWord_ReturnsIfInputCanBeCompletedToWord(bool expected, string input, string word)
        {
            // Arrange & Act
            bool actual = CompleteWord.CanComplete(input, word);

            // Assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
 void listBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         this.popup.IsOpen = false;
         CompleteWord selWord = (CompleteWord)this.listBox1.SelectedItem;
         this.SelectItem(this, new SelectItemEventArgs(selWord, this.inputedWord, this.Document));
         e.Handled = true;
     }
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
 }