ChLa
asked on
Can I make a popup menu appear with a left click ?
Hi,
I put a popup menu on a panel and of course it pops up when I right-click the panel..
Can I also make it pop up for a left click ?
I put a popup menu on a panel and of course it pops up when I right-click the panel..
Can I also make it pop up for a left click ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just to be safe
procedure TForm1.Panel1MouseDown(Sen
begin
if (Button = mbLeft) and (Sender is TPanel) then
TPanel(Sender).PopupMenu.P
end;
ewangoya, reinventing the wheel this evening? :)
Of course Sender is Tpanel here. It's a Tpanel event!
I've typecasted it just to skip easy its name ;)
Of course Sender is Tpanel here. It's a Tpanel event!
I've typecasted it just to skip easy its name ;)
Hi,
Just set the TrackButton property of PopupMenu to *tbLeftButton*
bye
Just set the TrackButton property of PopupMenu to *tbLeftButton*
bye
I can just as well do this
Panel1MouseDown(nil);
ASKER
I tried the first answer first because I thought I cuold use an on-click event, I didn't know the call to make the menu pop up. It worked perfectly.I appreciate everyone elses answer and learn from them also. The last two were especially interesting.
ASKER
Thank you
procedure TForm1.Panel1MouseDown(Sen
begin
if Button = mbLeft then
TPanel(Sender).PopupMenu.P
end;