1
votes

I am using Virtual TreeView and I need to select the root node when I click on the button. There is a RootNode property in TBaseVirtualTree, but based on the documentation, it is not used for enumeration. Also that root node is invisible and not the actual root of the whole tree.

1
What's a name of the component? Is it third party or Delphi-standard? Which Delphi version? - bunglehead
Is it really different from other nodes? From Win32 point of view you first locate a node identifier and then select it, must be something similar in your case. There is potential for multiple roots too. - bunglehead
@bunglehead The component is mentioned multiple times in title, body and tags. However I'm not sure which of the repos currently is the "official" one. - Uli Gerhardt

1 Answers

1
votes

Use code like the following to select the first node. Note that there is a separate function to get the first visible node (GetFirstVisible())

procedure TForm1.Button4Click(Sender: TObject);
var
  node: PVirtualNode;
begin
  node := VST.GetFirst();
  VST.Selected[node] := True;
end;