Board index » delphi » No OnMouseDown Event In DBGrid

No OnMouseDown Event In DBGrid

Anyone have an idea why I do not get an OnMouseDown event to trigger when I
click on a row in the grid, but the event does trigger when I click on the
grids's title (nothing in the OnClickTitle event)?

It's got to be something silly, but I can't find it.

TIA

 

Re:No OnMouseDown Event In DBGrid


Hello Al,

OnMouseDown never occurs for data cells because the inherited method is
not called in the TCustomDBGrid.MouseDown if cursor is over data cells
area.

--
Andrei Fomine.
DbAltGrid - multi-line layout, RTF and graphics of any kind in DBGrid.
Transfer@once - add full-blown clipboard and drag-and-drop support to any
control.
www.quasidata.com

Quote
"Al Wimberly" <del...@codethree.com> wrote in message

news:3c976560_2@dnews...
Quote
> Anyone have an idea why I do not get an OnMouseDown event to trigger
when I
> click on a row in the grid, but the event does trigger when I click on
the
> grids's title (nothing in the OnClickTitle event)?

> It's got to be something silly, but I can't find it.

> TIA

Re:No OnMouseDown Event In DBGrid


Quote
In article <3c976560_2@dnews>, Al Wimberly wrote:
> Anyone have an idea why I do not get an OnMouseDown event to trigger when I
> click on a row in the grid, but the event does trigger when I click on the
> grids's title (nothing in the OnClickTitle event)?

> It's got to be something silly, but I can't find it.

It's just the way the TDBGrid class was designed. You are not supposed to
mess with the grid in any way since doing so may seriously{*word*222}up the grids
working.

--
Peter Below (TeamB)  
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Re:No OnMouseDown Event In DBGrid


Peter --

Quote
>> It's just the way the TDBGrid class was designed. You are not supposed to

mess with the grid in any way since doing so may seriously{*word*222}up the
grids working. <<

OK, but ... I can get a OnMouseDown response from two other DBGrids on the
same form, all pretty much setup the same -- but not this one.

I'm trying to do a "fake" left mouse click in a DBGrid as you showed me how
to do last week in a DBCtrlGrid with messages.

One would think, then, if it is not to be used that the OnMouseDown event
would not be in the events list or that it would be named TitleOnMouseDown
or whatever.

Sign me confused (yet).

Al Wimberly

Re:No OnMouseDown Event In DBGrid


Quote
In article <3c97b627$1_1@dnews>, Al Wimberly wrote:
> OK, but ... I can get a OnMouseDown response from two other DBGrids on the
> same form, all pretty much setup the same -- but not this one.

Well, i don't (simple test setup, a DBDEMOS table tied to a TDBGrid).

--
Peter Below (TeamB)  
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Re:No OnMouseDown Event In DBGrid


AhHah -- I'm figuring it out but it still doesn't make sense.  In a grid
that is not fully populated, click in the area below the last row -- that
produces the OnClick event -- clicking on a row does not. Che pasa?

"Peter Below (TeamB)" <100113.1...@compuXXserve.com> wrote in message
news:VA.000085f3.00b18e9e@antispam.compuserve.com...

Quote
> In article <3c97b627$1_1@dnews>, Al Wimberly wrote:
> > OK, but ... I can get a OnMouseDown response from two other DBGrids on
the
> > same form, all pretty much setup the same -- but not this one.

> Well, i don't (simple test setup, a DBDEMOS table tied to a TDBGrid).

> --
> Peter Below (TeamB)
> Use the newsgroup archives :
> http://www.mers.com/searchsite.html
> http://www.tamaracka.com/search.htm
> http://groups.google.com
> http://www.prolix.be

Re:No OnMouseDown Event In DBGrid


Quote
"Al Wimberly" <del...@codethree.com> wrote in message

news:3c9888fa_1@dnews...

Quote
> AhHah -- I'm figuring it out but it still doesn't make sense.  In a grid
> that is not fully populated, click in the area below the last row -- that
> produces the OnClick event -- clicking on a row does not. Che pasa?

Curiously, though MouseDown only works on Fixed Columns/Rows (unless you
override it in a descendant) the MouseUp works on all parts of the grid.
You may wish to review my earlier suggested approach for DBGrid popups.

Regards,
Chris Luck.

Re:No OnMouseDown Event In DBGrid


Quote
In article <3c9888fa_1@dnews>, Al Wimberly wrote:
> AhHah -- I'm figuring it out but it still doesn't make sense.  In a grid
> that is not fully populated, click in the area below the last row -- that
> produces the OnClick event -- clicking on a row does not. Che pasa?

Well, that is the filter in the TDBGrid.MouseDown in action. If the down
happens on a non-fixed cell it does not call the inherited method (which
fires the event), otherwise it does.

--
Peter Below (TeamB)  
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Other Threads