【发布时间】:2012-08-21 22:58:44
【问题描述】:
我想选择所有根节点或所有子节点(不是 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;
我可以看出有一个小故障。 选择不完整或卡住。我做错了什么?
编辑:
我使用多选。
【问题讨论】:
-
我启用了多选属性。这有点迫使我使用 Node.States。抱歉,之前应该提到过。
标签: delphi delphi-7 virtualtreeview tvirtualstringtree