In order to set the row background color by a DB field:
- define the colors in t*grid.rowcolors.
- create an integer field which holds the color index, possibly it is a fkCalculated or fkInternalCalc field.
- select the color field in tdb*grid.datalink.fieldname_color.
- disable options1 co1_rowcolor in columns which should not change the background color.
An example is in mseuniverse/samples/db/gridcolorlines.
https://gitorious.org/mseuniverse/mseuniverseIt is also possible to select the font and merged, readonly and selected state of rows by a data field.
If you want to use onbeforedrawcell set cellinfo.color depending on the field value. Working with datapo is maybe a little bit dangerous, possibly the dataset cursor should be placed to the current row in the drawing events, I'll have a look.
The grid data can be accessed in tdbwidgetgrid by <editwidget>[cellinfo.cell.row], in tdbstringgrid by <column>[cellinfo.cell.row].
Posted after 1 hour 10 minutes 32 seconds:mse писал(а):possibly the dataset cursor should be placed to the current row in the drawing events, I'll have a look.
Done, git master f7b4a55483e56e0f25cfc02864e6d0a3ca9650b0.