ShellBrowser Delphi Components Documentation
ContentsIndexHome
Example

The following example will react on a right click of the user in a tree view. The full path of the folder is stored in the data property of the TTreeNode. If you are using Delphi 3, you should set the RightClickSelect property of your TTreeView to true.

procedure TMainForm.TreeViewMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var Node: TTreeNode;
begin
  if Button <> mbRight then exit;
  Node := TreeView.GetNodeAt(X,Y);
  if not Assigned(Node) then exit; // No Item hit
  ShellBrowser.ObjectName := PChar(Node.Data);
  ShellBrowser.ShowContextMenu(TreeView.ClientToScreen(Point(x,y)), nil);
end;