Currently I have this code to add some nodes to a VST
function AddVSTStructure(AVST: TCustomVirtualStringTree; ANode: PVirtualNode; AObject: TDATArecord): PVirtualNode;
var
Data: PUserData;
begin
Result := AVST.AddChild(ANode);
Data := AVST.GetNodeData(Result);
AVST.ValidateNode(Result, false);
Data^.FObject := AObject;
end;
//adding node
VDT1.BeginUpdate;
try
DATArecord.name := 'nodename';
DATArecord.Visible:= False;
AddVSTStructure(VDT1, nil, DATArecord);
finally
VDT1.EndUpdate;
end;
I want to add node in non-visible state, I mean completely invisible.
I know I can set the visibility of the node after adding it using VDT1.IsVisible[Node] := boolean;
But i want to set it non-visible before showing in the tree considering the record I add is set to DATArecord.Visible:= False;
So, if Datarecord.visible
is equal to true, add the node with visible state. If its false, add the node with non-visible state how can i do that?
Simply set the node's IsVisible
property immediately after you create the node:
Result := AVST.AddChild(ANode);
AVST.IsVisible[Result] := AObject.Visible; // <-- add this
The user is not going to see the node added since AddVSTStructure()
is being called inside the (Begin/End)Update
pair, so the add does not perform any onscreen update.