I was wondering if anyone has a method for determining which row is
currently being drawn (so I can stagger different color backgrounds)?
thanks,
charlie
> I was wondering if anyone has a method for determining which
> row is currently being drawn (so I can stagger different color
backgrounds)?
The OnDrawColumnCell event handler has a TColumn parameter. TColumn has a
Field property which you can use to determine the actual TField being drawn.
TField has properties for determining its position within the DB/Recordset,
such as FieldNo and Index.
Gambit
Charlie
You have two options:
1) Try using the Rect parameter with the inherited MouseCoord() method to
convert the pixel coordinates into row/col indexes.
2) derive a new class from TDBGrid and promote the DataLink property to
public in order to access the TDataLink::ActiveRecord property. Or derive a
new class from TDataSet and promote its ActiveRecord property to public for
accessing directly.
Gambit
If you only need access to the datalink object, consider using the
CM_GETDATALINK message. Hideous, but effective.
h^2
> I was wondering if anyone has a method for determining which row is
> currently being drawn (so I can stagger different color backgrounds)?
When the OnDrawColumCell event is fired, aren't you always drawing the
current row in the dataset? If this is true, can't you use the RecNo
property?
Note that RecNo is only meaningful for some datasets. For others, it
always returns -1. It does work for TClientDataSet.
h^2
> I was wondering if anyone has a method for determining which row is
> currently being drawn (so I can stagger different color backgrounds)?
When the OnDrawColumCell event is fired, aren't you always drawing the
current row in the dataset? If this is true, can't you use the RecNo
property?
Note that RecNo is only meaningful for some datasets. For others, it
always returns -1. It does work for TClientDataSet.
h2
If you only need access to the datalink object, consider using the
CM_GETDATALINK message. Hideous, but effective.
h2