Hardware Delphi

Title: How to select a TreeView node with the right mouse button
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;