Method calls are fine. Your component is supposed to be oblivious to your application. That's what "encapsulation" is all about. Did you read up on TMessage in the help file? You can create an event to capture the mouse info anywhere you need it as is done in that sample code. That was a useful example of how to use that technique. I'm not spoon feeding you the answer since you never supplied enough detail about your problem. I'm merely suggesting an area of study for you. Dave
David Wright <[EMAIL PROTECTED]> wrote: I caught the title click bit. And I had a feeling the method call from grid to form was not proper. I do not see how to get to the Message if I only use the double click event though. I thought I would have to use DefaultHandler of the grid? Sorry if I am missing something obvious... -----Original Message----- From: "David Smith" <[EMAIL PROTECTED]> Subj: RE: [advanced_delphi] Double-clicking row in DBGrid Date: Sun Dec 2, 2007 12:55 pm Size: 2K To: "advanced_delphi@yahoogroups.com" <advanced_delphi@yahoogroups.com> Dave, I wasn't suggesting that you subclass a new grid just to accomplish that. I was merely showing you how you could obtain the mouse coordinates from within a non coordinate event like the dblclick event (as opposed to MouseUp for example). I expected you to put your code in the dblclick event using TMessage to obtain the mouse coordinates as you saw in that code I provided. As far as the code you provided, it looks like you're calling an application form from within a component. This violates object oriented code principles and is not recommended. Another problem I see here is that your code won't prevent the default behavior on the title cell, which is cell.X = 0. Dave David Wright <[EMAIL PROTECTED]> wrote: Thanks Glen. I actually considered doing this a long time ago but stubbornly persisted trying to make my derived DBGrid work as it should. Like the other Dave said this is something I should know how to do anyhow. I spent some time studying then trying to override the DefaultHandler for the DBGrid and did finally get it. From everything I read on the web it should not have been so difficult. This was my first attempt (or need) to override a component. In case anyone is interested, and in case I did something bad without knowing it, here is how I made the DefaultHandler override work... Basically, I added two things to my form's main unit. A declaration for an overriden DefaultHandler before the form declaration and then the actual procedure. // Override declaration type TSMDBGrid = class(SMDBGrid.TSMDBGrid) public procedure DefaultHandler(var Msg); override; end; // frmOQ declaration... // Override procedure procedure TSMDBGrid.DefaultHandler(var Msg); var Cell: TGridCoord; begin inherited DefaultHandler(Msg); if TMessage(Msg).Msg = WM_LBUTTONDBLCLK then with TWMLBUTTONDBLCLK(Msg) do begin Cell := MouseCoord(XPos, YPos); if (Cell.X < 0) or (Cell.Y < 0) then Exit else frmOQ.mnuOpenClick(self); end; end; A couple of hours spent learning (instead of billing) is not how I planned to spend my Sunday morning, but that's just how it goes sometimes :) --------------------------------- Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. --------------------------------- Get easy, one-click access to your favorites. Make Yahoo! your homepage.