title: How to select all root or all child nodes in VirtualStringTree?
body: <p>I would like to select either all root nodes or all child nodes (not all nodes in a VirtualTreeView).<br>
  I've tried to use this code to select all root nodes:</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>I can tell there's a small glitch. 
  The selection is either incomplete or gets stuck. What am I doing wrong ?</p>
  
  <p><strong>Edit:</strong><br>
  I use MultiSelection.</p>