Thanks!

I completely overlooked the TMessage bit of the prior response...

I will get it working from here-thanks to both of you.


-----Original Message-----

From:  "David Smith" <[EMAIL PROTECTED]>
Subj:  RE: [advanced_delphi] Double-clicking row in DBGrid
Date:  Sun Dec 2, 2007 7:27 am
Size:  2K
To:  "advanced_delphi@yahoogroups.com" <advanced_delphi@yahoogroups.com>

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   

Reply via email to