Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 731
randydom Avatar asked Feb 19 '23 07:02

randydom


1 Answers

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;
like image 70
David Heffernan Avatar answered Feb 28 '23 01:02

David Heffernan