Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I color a cxgrid based on table value?

I would like all rows where in particular field name 'hello' is present to get colored green. I tried this on customdrawcell:

if abstable1.fieldbyname('somename').asstring = 'Hello' then
  cxgrid.canvas.brush.color:=clGreen

But it wont work... what am I missing here ?

like image 410
user763539 Avatar asked Nov 30 '22 16:11

user763539


1 Answers

Use the OnGetContentStyle event for either individual columns or the grid object. Styles are much easier to work with than messing with the canvas.

like image 190
Sam M Avatar answered Dec 09 '22 15:12

Sam M