Hi Chris
The help for TTreeNode.MoveTo is incorrect. It should say "naInsert
Insert the node BEFORE the destination node."
Knowing this should explain everything. :)
Cheers,
Carl Reynolds Ph: +64-9-4154790
CJN Technologies Ltd. Fax: +64-9-4154791
[EMAIL PROTECTED] DDI: +64-9-4154795
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/
> -----Original Message-----
> From: Chris Crowe [SMTP:[EMAIL PROTECTED]]
> Sent: Sunday, April 18, 1999 6:40 PM
> To: Multiple recipients of list delphi
> Subject: [DUG]: Tree View - Moving a node DOWN the tree..
>
> 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
application/ms-tnef