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.

Reply via email to