Me gustaría seleccionar todos los nodos raíz o todos los nodos secundarios (no todos los nodos en un VirtualTreeView).
He tratado de utilizar este código para seleccionar todos los nodos raíz:¿Cómo seleccionar todos los nodos raíz o todos los secundarios en VirtualStringTree?
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;
me puede decir que hay un pequeño problema técnico. La selección está incompleta o se atasca. Qué estoy haciendo mal ?
Editar:
Uso MultiSelection.
Tengo propiedad de selección múltiple habilitada. Eso me obliga a usar el Node.States. Lo siento, debería haber mencionado eso antes. –