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.
<http://us.rd.yahoo.com/evt=51731/*http://mobile.yahoo.com/sports;_ylt=A
t9_qDKvtAbMuh1G1SQtBI7ntAcJ>  

 

Reply via email to