Board index » delphi » Treeview edit text problem - please help!!!!!

Treeview edit text problem - please help!!!!!

How can I implement editting of all the nodes text captions in a tree
view sequentially, so that after editting the first node it
automatically invokes the next node for editting?

The problem is that because TreeNode.EditText is a function and only
sends a system message, it returns before editting is finished. Having
a loop like the following example simply flashed through the nodes
before editting has occured.  

with TreeView do
   for n := 0 to Items.Count - 1 do
     Items[n].EditText;

Also calling EditText method in OnEditted or OnEdtting event handlers
simply gives spurious situations and hangs the machine.

procedure TForm1.TreeViewEdited(Sender: TObject; Node: TTreeNode; var
S:
String);
begin
    Treeview.Selected := Node.GetNext;  
    Treeview.Selected.EditText;                
end;

Can anyone answer this?

 

Re:Treeview edit text problem - please help!!!!!


You might try modifying the WndProc of the TreeView window to look for
TVN_ENDLABELEDIT message. The treeview item sends this to its parent window
in the form of a WM_NOTIFY. Delphi has a description of the message buried
in the API documentation in the WIN32.hlp file.

Other Threads