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 --------------------------------- Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. --------------------------------- Never miss a thing. Make Yahoo your homepage.