Esempio n. 1
0
 protected void OnBeforeNodeTextEdit(BeforeNodeTextEditEventArgs e)
 {
    if (this.BeforeNodeTextEdit != null)
       this.BeforeNodeTextEdit(this, e);
 }
Esempio n. 2
0
   internal void BeginNodeTextEdit(TreeNode tn, TreeNodeLayoutItem layoutItem)
   {
      if (tn == null || layoutItem == null)
         return;

      if (this.editingTreeNode != null)
         this.EndNodeTextEdit(true);

      BeforeNodeTextEditEventArgs e = new BeforeNodeTextEditEventArgs(tn);
      this.OnBeforeNodeTextEdit(e);

      if (e.Cancel)
         return;

      this.editingTreeNode = tn;
      this.editTextBoxOpening = true;
      this.editTextBox = new TextBox();

      Rectangle bounds = layoutItem.GetBounds(tn);
      int itemIndex = layoutItem.Layout.LayoutItems.IndexOf(layoutItem);
      if (itemIndex < layoutItem.Layout.LayoutItems.Count - 1)
      {
         TreeNodeLayoutItem nextItem = layoutItem.Layout.LayoutItems[itemIndex + 1];
         if (nextItem is EmptySpace)
         {
            bounds.Width += nextItem.GetWidth(tn);
         }
      }
      this.editTextBox.Location = bounds.Location;
      this.editTextBox.Size = new Size (Math.Max(100, bounds.Width), 18);
      this.editTextBox.Text = e.EditText;
      this.editTextBox.KeyDown += new KeyEventHandler(editTextBox_KeyDown);
      this.editTextBox.LostFocus += new EventHandler(editTextBox_LostFocus);

      this.editTextBox.Parent = this;
      this.editTextBox.Focus();
      this.editTextBox.SelectAll();
      
   }
Esempio n. 3
0
   protected virtual void tree_BeforeNodeTextEdit(object sender, BeforeNodeTextEditEventArgs e)
   {
      IMaxNode node = TreeMode.GetMaxNode(e.TreeNode);
      if (node == null)
      {
         e.Cancel = true;
         return;
      }

      if (!node.CanEditName)
      {
         WinForms::MessageBox.Show( Tree
                                  , OutlinerResources.Warning_CannotEditName
                                  , OutlinerResources.Warning_CannotEditNameTitle
                                  , WinForms::MessageBoxButtons.OK
                                  , WinForms::MessageBoxIcon.Warning);
         e.Cancel = true;
         return;
      }

      e.EditText = node.Name;

      MaxInterfaces.Global.DisableAccelerators();
   }