randydom
randydom

Reputation: 405

delphi Treeview node manipulation

i have this treeview structure :

Users
  |_Online
  |_Offline
    |_ user1 --> current status offline 
    |_ user2 --> current status Online
    |_ user3 --> current status offline
    |_ user4 --> current status online

what i want to do is when a user is online he will be deleted from offline node and moved to the Online node . example for user2 and user4 , any help please

many thanks

Upvotes: 4

Views: 1665

Answers (1)

David Heffernan
David Heffernan

Reputation: 612794

Under the assumption that you are using the built in TTreeView, then you can call the TTreeNode.MoveTo method.

user2node.MoveTo(onlineNode, naAddChild);

If a comment you ask:

How can I access the offline child nodes in code?

Like so:

node := offlineNode.getFirstChild;
while Assigned(node) do
begin
  DoSomething(node);
  node := node.getNextSibling;
end;

Upvotes: 8

Related Questions