delphi Treeview node manipulation

delphi, treeview

Solution

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;

Problem

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

Original source