Hi,
My issue is that I can rename a node for some case, but not for another.
I'll explain quickly :
I have a RenameNode( node ) function which calls :
MyNode.AllowCellEdit = AllowCellEdit.Full; MyNode.BeginEdit()
I call RenameNode(MyNode) on the doubleClick Event, and the KeyDown Event ( if key is F2 )
When I double click on my node, I can edit his name, and after when I press enter, I go in the AfterLabelEdit() event, everything works fine.
When I press F2 I call my RenameNode(MyNode) function, and just after that function ends, AfterLabelEdit is firered, I didn't have the time to touch the name of the node, and the AfterLabelEdit is already triggered.
I would like to know what can cause that ? which event can stop the edition of the node ? if someone have already implement the F2 shortcut to rename a UltratreeNode.
Thanks
David
Hi David,
The two lines of code you have here don't make sense together. AllowCellEdit deals with the editing of cells. So this property only applies when you using a ViewStyle like Grid or OutlookExpress where the tree displays multiple columns.
The BeginEdit method on the node only applies when the ViewStyle is standard - there are no columns in the tree.
Assuming your tree is in Standard ViewStyle, you don't need to do anything in either DoubleClick or KeyDown to allow editing of nodes. The tree already has this functionality built-in. You just have to set the LabelEdit property on the Override to allow editing. You can just set this up initially, like in the Form_Load or at desing-time and clicking twice on a node or selecting a node and pressing F2 will cause that node to enter label edit mode, just like Windows Explorer.
ok ,
thank you