procedure TForm1.TreeView1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean); var tmpNode: TTreeNode; begin tmpNode := (Sender as TTreeView).GetNodeAt(MousePos.X, MousePos.Y); if tmpNode <> nil then TTreeView(Sender).Selected := tmpNode; end;