Board index » delphi » Popup menu location on dbgrid right click

Popup menu location on dbgrid right click

Hi,

Using the code below, when I right click on a dbgrid I bring up a popup
menu.  Unfortunately, the menu doesn't popup anywhere NEAR where I'm
right clicking.

How can I make the popup menu display where I've right clicked with the
mouse?

Thanks,
Neill
========
procedure TfrmTest.dbgCDRLMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if button = mbRight then popMaint.Popup(x, y);
end;

 

Re:Popup menu location on dbgrid right click


In article <7b63a41eb072a6be5acdd2d9a346c...@spamfreenews.org>, Neill Dumont

Quote
<justthisonce5REM...@hotmail.com> writes:
>begin
>  if button = mbRight then popMaint.Popup(x, y);
>end;

PopUp pops up at screen coordinates of X & Y (see TPopUp.PopUp help), use the
ClientToScreen transform of the DB grid ...

var
  PopUpPt : TPoint;
begin
  PopUpPt := dbgCDRL.ClientToScreen(point(X, Y)
  if button = mbRight then popMaint.Popup(PopUpPt.X, PopUpPt.Y);
end;

Alan Lloyd
alangll...@aol.com

Other Threads