title: Delphi: checking selection in Tree View
body: <p>There is a Tree View with 2 levels of items. I need to add a text of all selected "sub" (level 1) items into a Memo.</p>
  
  <pre><code>for i := 0 to pred(TreeView1.Items.count) do 
  if (TreeView1.Items.Item[i].Selected) and (TreeView1.Items.Item[i].Level=1)
     then 
         begin
              Memo1.Lines.Add(TreeView1.Items.Item[i].Text)
         end;
  </code></pre>
  
  <p>But how to add all the "sub" items at once without their checking (selected or not) if their parent (level 0) is selected? E.g. I select the 3 items with the level 0 and their children are added into the Memo.</p>
  
  <p>Thanks for help!</p>