title: VirtualTreeView embedding button in the cells
body: <p>I'm trying to create node with TButton.
  I Create the node and the buttons linked to the nodes.
  On the event TVirtualStringTree.AfterCellPaint, I initialise the BoundsRect on the button. But the button is always shown in the first node.</p>
  
  <p>Have you some idea of the problem?</p>
  
  <pre><code>type
    TNodeData = record
      TextValue: string;
      Button: TButton;
    end;
    PNodeData = ^TNodeData;
  
  procedure TForm1.FormCreate(Sender: TObject);
  
    procedure AddButton(__Node: PVirtualNode);
    var
      NodeData: PNodeData;
    begin
      NodeData := VirtualStringTree1.GetNodeData(__Node);
      NodeData.Button := TButton.Create(nil);
      with NodeData.Button do
      begin
        Parent := VirtualStringTree1;
        Height := VirtualStringTree1.DefaultNodeHeight;
        Caption := '+';
        Visible := false;
      end;
    end;
  
    procedure InitializeNodeData(__Node: PVirtualNode; __Text: string);
    var
      NodeData: PNodeData;
    begin
      NodeData := VirtualStringTree1.GetNodeData(__Node);
      NodeData.TextValue := __Text;
    end;
  
  var
    Node: PVirtualNode;
  begin
    VirtualStringTree1.NodeDataSize := SizeOf(TNodeData);
  
    Node := VirtualStringTree1.AddChild(nil);
    InitializeNodeData(Node, 'a');      
    Node := VirtualStringTree1.AddChild(Node);
    InitializeNodeData(Node, 'a.1');
  
    Node := VirtualStringTree1.AddChild(nil);
    InitializeNodeData(Node, 'b');
    Node := VirtualStringTree1.AddChild(Node);
    InitializeNodeData(Node, 'Here the button');
    AddButton(Node);
  end;
  
  procedure TForm1.VirtualStringTree1AfterCellPaint(Sender: TBaseVirtualTree;
    TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; CellRect: TRect);
  var
   NodeData: PNodeData;
  begin
    if (Column = 0) then
      Exit;
  
    NodeData := VirtualStringTree1.GetNodeData(Node);
    if (Assigned(NodeData)) and (Assigned(NodeData.Button)) then
    begin
      with NodeData.Button Do
      begin
        Visible := (vsVisible in Node.States)
                   and ((Node.Parent = VirtualStringTree1.RootNode) or   (vsExpanded in Node.Parent.States));
        BoundsRect := CellRect;
      end;
    end;
  end;
  </code></pre>