Thanks to all who answered my question.  The onMouseUp event was exactly
what I wanted.  Here is my final procedure:

procedure TForm1.DBGrid2MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if Button = mbRight then
If MessageDlg('Delete Record?',mtWarning ,[mbYes,mbNo],0) = mrYes
then DM.ChartDetlTbl.Delete;
end;

Works like a charm!

Thanks Again!

Tom Nesler
Live long!...   Code Well!...   and Prosper!...   V

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Rob Kennedy
Sent: Thursday, June 07, 2007 11:49 AM
To: [email protected]
Subject: Re: [delphi-en] Detecting a Right click Mouse action inside a
Grid Cell


Nesler, Thomas J wrote:
> How to do this is the rub!...:-)  That's why I was hoping I could
> piggyback an existing event.

Like I said before, when any mouse button (including the right one) is 
released, the grid fires its OnMouseUp event. That tells you which 
button was released, and where.

> Is there a way to detect a right click
> inside the OnCellClick event?  If I could do this then I would be all
> set!

No, OnCellClick won't work. That even only gets fired when the mouse 
button released was the left one.

By the way, I'm getting all my information by reading the VCL source 
code. Go look at DBGrids.TCustomDBGrid.MouseUp. Among other things, it 
shows how to turn a control's client coordinates into grid coordinates, 
and that's the final piece of the puzzle.

-- 
Rob


-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links



Reply via email to