Dave, There is a simpler way to do this with the standard grid if you want to avoid subclassing.
All you need to do is track which cell was clicked last. When a DblClick event is fired, The cell which was double-clicked would have to be the last cell that was clicked. To do this, use the MouseDown event, which passes XY mouse coordinates, with the MouseToCell method to determine the Col and Row clicked and save in variables. Here is an example: const MyGridSpecialRow = 5; var MyGridLastColClicked, MyGridLastRowClicked: integer; procedure TMainForm.MyGridMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin MyGrid.MouseToCell(X,Y,MyGridLastColClicked,MyGridLastRowClicked); {Do whatever else you want to happen in the MouseDown event} end; procedure TMainForm.MyGridDblClick(Sender: TObject); begin if MyGridLastRowClicked = MyGridSpecialRow then {Do whatever}; end; Glenn Lawler www.incodesystems.com -----Original Message----- From: David Smith [SMTP:[EMAIL PROTECTED] Sent: Sunday, December 02, 2007 8:51 AM To: advanced_delphi@yahoogroups.com Subject: RE: [advanced_delphi] Double-clicking row in DBGrid TMesssage is a custom message event. That is how you obtain the mouse coordinates in a non click event. Look at the source code of this event in DBGrids.pas and copy its usage of TMessage. Also look up in help about TMessage. It's a skill you obviously need to add to your toolbox. Dave David Wright <[EMAIL PROTECTED]> wrote: Thanks... I have done very similar code for popup menus, but how would this translate to a double-click event -- that is what is stumping me... --------------------------------- From: advanced_delphi@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of David Smith Sent: Saturday, December 01, 2007 8:03 PM To: advanced_delphi@yahoogroups.com Subject: Re: [advanced_delphi] Double-clicking row in DBGrid As is shown in the source code for DBGrid.pas below. Catch the mouse button up message (which supplies the mouse coordinates) and use with the built-in functions to find out where you are and process accordingly: procedure TCustomDBGrid.DefaultHandler(var Msg); var P: TPopupMenu; Cell: TGridCoord; begin inherited DefaultHandler(Msg); if TMessage(Msg).Msg = wm_RButtonUp then with TWMRButtonUp(Msg) do begin Cell := MouseCoord(XPos, YPos); if (Cell.X < FIndicatorOffset) or (Cell.Y < 0) then Exit; P := Columns[RawToDataColumn(Cell.X)].PopupMenu; if (P <> nil) and P.AutoPopup then begin SendCancelMode(nil); P.PopupComponent := Self; with ClientToScreen(SmallPointToPoint(Pos)) do P.Popup(X, Y); Result := 1; end; end; end; David Wright <[EMAIL PROTECTED]> wrote: Hi All, I am having a total mind blank right now... I know I have done this before, but exactly how escapes me. I want to enable the user to double-click on a row in a DBGrid to launch an action. That part is easy and works fine. What I cannot remember how to do is ignore double-clicks that occur somewhere other than a row in the table. For example, if I double-click the title bar or the whitespace below the last row, I do not want to launch the action. I know I can get Mouse Coordinates from the MouseDown event, but how do I do this in the Double Click event? Any guidance will be appreciated, Thanks! Dave