void comboBox_DropDownClosed(object sender, EventArgs e)
        {
            // Remember current index
            int selIndex = 0;

            if (TreeView.SelectedNode != null)
            {
                selIndex = TreeView.SelectedNode.Index;
            }

            Control c = sender as Control;

            if (c != null && c.Tag == targetNodeControl)
            {
                targetNodeControl.EndEdit(true);

                // Try to select previous index again
                if (selIndex < TreeView.Root.Children.Count)
                {
                    TreeView.SelectedNode = TreeView.Root.Children[selIndex];

                    columnEnabledFkNodeControl.Parent.Focus();
                }
            }
        }
Beispiel #2
0
        void textBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Tab || e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
            {
                Control c = sender as Control;
                if (c != null)
                {
                    if (c.Tag == nameNodeControl)
                    {
                        // Remember current index
                        int selIndex = 0;
                        if (TreeView.SelectedNode != null)
                        {
                            selIndex = TreeView.SelectedNode.Index;
                        }
                        TextBox t     = c as TextBox;
                        string  value = "";
                        if (t != null)
                        {
                            value = t.Text;
                        }

                        nameNodeControl.EndEdit(true);

                        // Try to select previous index again
                        if (selIndex < TreeView.Root.Children.Count && value.Length > 0)
                        {
                            TreeView.SelectedNode = TreeView.Root.Children[selIndex];

                            targetColumnNodeControl.BeginEdit();
                        }
                        e.Handled = true;
                    }
                    else if (c.Tag == targetColumnNodeControl)
                    {
                        // Remember current index
                        int selIndex = 0;
                        if (TreeView.SelectedNode != null)
                        {
                            selIndex = TreeView.SelectedNode.Index;
                        }
                        TextBox t     = c as TextBox;
                        string  value = "";
                        if (t != null)
                        {
                            value = t.Text;
                        }

                        targetColumnNodeControl.EndEdit(true);

                        e.Handled = true;
                    }
                }
            }
        }
Beispiel #3
0
        void textBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                // notify cancel editing placeholder
                if (TreeView.SelectedNode != null)
                {
                    grtList.set_field(new NodeIdWrapper(TreeView.SelectedNode.Index), 0, 0);
                }
                RefreshModel();
            }
            else if (e.KeyCode == Keys.Tab || e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
            {
                Control c = sender as Control;
                if (c != null)
                {
                    if (c.Tag == nameNodeControl)
                    {
                        // Remember current index
                        int selIndex = 0;
                        if (TreeView.SelectedNode != null)
                        {
                            selIndex = TreeView.SelectedNode.Index;
                        }
                        TextBox t     = c as TextBox;
                        string  value = "";
                        if (t != null)
                        {
                            value = t.Text;
                        }

                        nameNodeControl.EndEdit(true);

                        // Try to select previous index again
                        if (selIndex < TreeView.Root.Children.Count && value.Length > 0)
                        {
                            TreeView.SelectedNode = TreeView.Root.Children[selIndex];

                            //datatypeNodeControl.BeginEdit();
                            datatypeComboBoxNodeControl.BeginEdit();
                        }
                        else
                        {
                            if (TreeView.SelectedNode != null)
                            {
                                // notify cancel editing placeholder
                                grtList.set_field(new NodeIdWrapper(selIndex), 0, 0);
                                RefreshModel();
                            }
                        }
                        e.Handled = true;
                    }
                    else if (c.Tag == datatypeComboBoxNodeControl)
                    {
                        // Remember current index
                        int selIndex = 0;
                        if (TreeView.SelectedNode != null)
                        {
                            selIndex = TreeView.SelectedNode.Index;
                        }
                        ComboBox t     = c as ComboBox;
                        string   value = "";
                        if (t != null)
                        {
                            value = t.Text;
                        }

                        datatypeComboBoxNodeControl.EndEdit(true);

                        // Try to select previous index again
                        if (selIndex < TreeView.Root.Children.Count && value.Length > 0)
                        {
                            TreeView.SelectedNode = TreeView.Root.Children[selIndex];

                            // automatically go to the next row if this is the last "real" row
                            if (TreeView.SelectedNode != null &&
                                TreeView.SelectedNode.NextNode != null &&
                                TreeView.SelectedNode.NextNode.NextNode == null)
                            {
                                TreeView.SelectedNode =
                                    TreeView.SelectedNode.NextNode;

                                nameNodeControl.BeginEdit();
                            }
                            else
                            {
                                if (TreeView.SelectedNode != null)
                                {
                                    // notify cancel editing placeholder
                                    grtList.set_field(new NodeIdWrapper(selIndex), 0, 0);
                                    RefreshModel();
                                }
                            }
                        }
                        else
                        {
                            if (TreeView.SelectedNode != null)
                            {
                                // notify cancel editing placeholder
                                grtList.set_field(new NodeIdWrapper(TreeView.SelectedNode.Index), 0, 0);
                                RefreshModel();
                            }
                        }

                        e.Handled = true;
                    }
                    else if (c.Tag == defaultNodeControl)
                    {
                        defaultNodeControl.EndEdit(true);
                        e.Handled = true;
                    }
                }
            }
        }