There is a list View + a PopUpMenu. I need that the PopUpMenu appears when items are present. The menu must not appears when 0 items.
Is this approximate code appropriate (can be used as a basis)?
procedure TForm1.StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var P: TPoint;
begin
P:=GetClientOrigin;
if Button = mbRight then
PopupMenu1.Popup(X+P.X+StringGrid1.Left, Y+P.Y+StringGrid1.Top);
end;
Are there other ways?
Thanks!!!
Firstly, don’t do anything on a mouse event because the popup menu can be invoked from the keyboard.
The best way to do this, in my view, is to handle the
OnPopupevent. If you want the menu not to appear callAbort.