Hi, all
I am having trouble with moving a node down a treeview.
Basically I have a tree as follows
Parent Node
- Level 1 Node
- Level 2 Node (Index 0)
- Level 2 Node (Index 1)
- Level 2 Node (Index 2)
I want to move "Level 2 Node (Index 0)" down to where "Level 2 Node (Index 1)" is. But
I do not seem to be able to do it.
If "Level 2 Node (Index 0)" is the selected node in the tree view. Then I should be
able to do this...
NewNode := RightTree.Selected;
RightTree.Selected.MoveTo(NewNode, naInsert);
RightTree.Selected := NewNode;
NewNode is of type TTreeNode. Now the docs for MoveTo state "naInsert Insert the
node after the destination node." There for it should work since "NewNode" is the
selected node it should insert it after it. But stepping into the Delphi treeview code
the naInsert changes into a naAddFirst.
so I tried this..
NewNode := RightTree.Selected;
RightTree.Selected.MoveTo(NewNode.GetNextSibling, naInsert);
RightTree.Selected := NewNode;
This time the naInsert is OK, but this Delphi treeview code has this statement.
if (Destination <> Self) then { line 6136 : ComCtrls.PAS }
InternalMove(Node, Destination, HItem, AddMode);
It stops me from doing it, since Destination and SELF are the same.
Any ideas?, maybe I move the next sibling node UP. Going up seems to work OK.....
Chris
Christopher Crowe (Software Developer)
Microsoft MVP, MCP
Adrock Software
Byte Computer & Software LTD
P.O Box 13-155
Christchurch
New Zealand
Phone/Fax (NZ) 03-3651-112
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz