すべてのルート ノードまたはすべての子ノード (VirtualTreeView 内のすべてのノードではない) を選択したいと考えています。
このコードを使用して、すべてのルート ノードを選択しようとしました。
procedure SelectAllRoots;
var
Node: PVirtualNode;
begin
Form1.VirtualStringTree1.BeginUpdate;
Node := Form1.VirtualStringTree1.GetFirst;
while True do
begin
if Node = nil then
Break;
if not (vsSelected in Node.States) then
Node.States := Node.States + [vsSelected];
Node := Form1.VirtualStringTree1.GetNext(Node);
end;
Form1.VirtualStringTree1.EndUpdate;
end;
小さな不具合があることがわかります。選択が不完全であるか、スタックしています。私は何を間違っていますか?
編集:
MultiSelectionを使用しています。