Permalink Submitted by Sebastiaan (not verified) on Wed, 07/24/2013 - 08:34
Using the OnMouseDown Event.
procedure TForm2.cxTreeList1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
lStringList: TStringlist;
lCounter: Integer;
lPoint : TPoint;
begin
if Button = mbRight then
begin
if cxTreeList1.GetNodeAt(X, Y) nil then
begin
lStringList := TStringlist.Create;
for lCounter := 0 to cxTreelist1.Nodes.Count - 1 do
begin
if cxTreelist1.Items[lCounter].Selected then
begin
lStringList.Add(cxTreelist1.Items[lCounter].Values[0]);
end;
end;
ShowSysPopup(lStringList, X, Y, Handle);
lStringList.Free;
end
else
begin
Windows.ClientToScreen(cxTreelist1.Handle, lPoint);
PopupMenu1.Popup(lPoint.X + X, lPoint.Y + Y); //If no 'files' selected popup de default menu
end;
end;
end;
Found solution that meets my requirement
Using the OnMouseDown Event.
Shift: TShiftState; X, Y: Integer);
var
lStringList: TStringlist;
lCounter: Integer;
lPoint : TPoint;
begin
if Button = mbRight then
begin
if cxTreeList1.GetNodeAt(X, Y) nil then
begin
lStringList := TStringlist.Create;
for lCounter := 0 to cxTreelist1.Nodes.Count - 1 do
begin
if cxTreelist1.Items[lCounter].Selected then
begin
lStringList.Add(cxTreelist1.Items[lCounter].Values[0]);
end;
end;
ShowSysPopup(lStringList, X, Y, Handle);
lStringList.Free;
end
else
begin
Windows.ClientToScreen(cxTreelist1.Handle, lPoint);
PopupMenu1.Popup(lPoint.X + X, lPoint.Y + Y); //If no 'files' selected popup de default menu
end;
end;
end;