Re: Reordering TreeNodes




How can I swap (reorder) nodes in an unsorted TreeView.

TTreeNode.Moveto. There is a help file, you know.

Yes; I already managed; I wrote a procedure using MoveTo. But I expected just one simple call.

procedure SwapNodes(Node1 : TTreeNode);
var
Node2 : TTreeNode;
Node1Expanded, Node2Expanded : boolean;
begin
if Node1 = nil then Exit;
Node2 := Node1.GetNextSibling;
if Node2 = nil then Exit;
Node1Expanded := Node1.Expanded;
Node2Expanded := Node2.Expanded;
Node2.MoveTo(Node1, naInsert);
if Node1Expanded then Node1.Expand(True);
if Node2Expanded then Node2.Expand(True);
TreeView.Selected := Node1;

ToggleStates(TreeView);
end;

Call with e.g.

SwapNodes(TreeView.Selected);

And ... I'd be rich, getting paid for reading the helpfile.

Groetjes,
Maarten Wiltink

Thanks,
Fons.

.



Relevant Pages

  • 403 Error after extending a SharePoint Site
    ... Create Config DB from NODE1 and connect to the DB in NODE2 ... Test extended site in NODE1 and apply template. ... I've already re-installed SharePoint Portal Server and still get the same ...
    (microsoft.public.sharepoint.windowsservices)
  • DSSI, MSCP serving and identical nodes
    ... I am trying to workout a transition scenario from my current environment ... node1 has allocation class of 1, ... node1 will be the primary node with node2 probably down most of the ...
    (comp.os.vms)
  • Re: Resources not coming online
    ... When I failover from node1 to node2, ... SQL Server, SQL Server Aent and SQL Analysis services do not come online. ... If I failover to node2 again, ... service passwords on node1. ...
    (microsoft.public.sqlserver.clustering)
  • distributed key generation
    ... I have computer network with nodes: Node1, Node2, Node3. ...
    (sci.crypt)
  • Can not ping Node1 to Node2 after failover
    ... Have an NLB with 2 nodes were both nodes are using 1 network card and running ... Cant ping Node1 to Node2 ... Can ping all other devices on the network from both Node1 and Node2 ...
    (microsoft.public.windows.server.clustering)