We help IT Professionals succeed at work.

select tree node by right button

ws1999
ws1999 asked
on
i make a tree, and i found the node cannot be selected by right button. how can i achieve this?

ws1999
Comment
Watch Question

Commented:
Hi, just set RightClickSelect property to True :-)
Commented:
procedure TForm1.TreeView1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
     TreeView1.GetNodeAt(x,y).Focused:=True;
     TreeView1.GetNodeAt(x,y).Selected:=True;
end;

Commented:
procedure TForm1.TreeView1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  TreeView1.Selected.Selected:=TreeView1.Selected.Selected or (Button=mbRight);
end;

Commented:
procedure TForm1.TreeView1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  TreeView1.Selected.Selected:=TreeView1.Selected.Selected or (Button=mbRight);
end;

Author

Commented:
Thanks

ws1999

Explore More ContentExplore courses, solutions, and other research materials related to this topic.