Esempio n. 1
0
 public void UnSelected(IPropertyEntry unselected)
 {   // the entry with the textBox or listBox is being unselected (by as mouseClick on a different entry), so we accept the input as valid (not aborted)
     if (EntryWithTextBox == unselected)
     {
         EntryWithTextBox.EndEdit(false, textBox.Modified, textBox.Text);
         HideTextBox();
     }
     else if (EntryWithListBox == unselected)
     {
         EntryWithListBox.ListBoxSelected(listBox.SelectedIndex);
         HideListBox();
     }
 }
Esempio n. 2
0
        public void PreProcessKeyDown(Substitutes.KeyEventArgs e)
        {                                                         // this is being called after the ActiveAction has preprocessed (and not handled) the key down message
            // we can handle it here, before it gets handled by maybe and edit text box or something else (menu?)
            switch ((Substitutes.Keys)((int)e.KeyData & 0x0FFFF)) // was KeyCode, but didn't work
            {
            case Substitutes.Keys.Tab:
                if ((e.KeyData & Substitutes.Keys.Control) != 0)
                {       // we use the Ctrl key to switch between property pages
                    int sel = -1;
                    for (int i = 0; i < tabControl.TabPages.Count; i++)
                    {
                        if (tabControl.TabPages[i] == tabControl.SelectedTab)
                        {
                            sel = i;
                            break;
                        }
                    }
                    if (sel >= 0)
                    {
                        if ((e.KeyData & Substitutes.Keys.Shift) != 0)
                        {
                            sel = (sel + tabControl.TabPages.Count - 1) % tabControl.TabPages.Count;
                        }
                        else
                        {
                            sel = (sel + 1) % tabControl.TabPages.Count;
                        }
                        tabControl.SelectedTab = tabControl.TabPages[sel];
                    }
                }
                else
                {
                    if (EntryWithTextBox != null)
                    {
                        EntryWithTextBox.EndEdit(false, textBox.Modified, textBox.Text);
                        HideTextBox();
                    }
                    else if (EntryWithListBox != null)
                    {
                        EntryWithListBox.ListBoxSelected(listBox.SelectedIndex);
                        HideListBox();
                    }
                    SelectNextEntry((e.KeyData & Substitutes.Keys.Shift) == 0);
                }
                e.Handled          = true;
                e.SuppressKeyPress = true;
                break;

            case Substitutes.Keys.Enter:
                if (EntryWithTextBox != null)
                {
                    EntryWithTextBox.EndEdit(false, textBox.Modified, textBox.Text);
                    HideTextBox();
                }
                else if (EntryWithListBox != null)
                {
                    EntryWithListBox.ListBoxSelected(listBox.SelectedIndex);
                    HideListBox();
                }
                else if (ActivePropertyPage is PropertyPage pp)
                {
                    pp.OnEnter();
                }
                e.Handled = true;
                break;

            case Substitutes.Keys.Escape:
                if (EntryWithTextBox != null)
                {
                    EntryWithTextBox.EndEdit(true, textBox.Modified, textBox.Text);
                    HideTextBox();
                    e.Handled = true;
                }
                else if (EntryWithListBox != null)
                {
                    // no notification of the entry, nothing has changed until now
                    HideListBox();
                    e.Handled = true;
                }
                break;

            case Substitutes.Keys.Down:
                SelectNextEntry(true);
                e.Handled = true;
                break;

            case Substitutes.Keys.Up:
                SelectNextEntry(false);
                e.Handled = true;
                break;
            }
        }
Esempio n. 3
0
 private void ListBox_MouseClick(object sender, MouseEventArgs e)
 {
     EntryWithListBox.ListBoxSelected(listBox.SelectedIndex);
     HideListBox();
 }