Subject Re: Grid Fieldname
From Andy Taylor <andy.taylor.1959@outlook.com>
Date Sat, 30 Apr 2022 11:52:13 -0400
Newsgroups dbase.getting-started

Hi Rob,

Will you change the grid datalink property during the course of using the form?
If not then I would not use the beforeCellPaint event as that fires every time the grid is redrawn.

I would do this as part of form.onOpen or perhaps just after form creation and before you open it.
You would then only be running the code once and your grid will be more responsive in use.

My once-run only code would be looking at each of the column fieldnames in turn and changing the colour accordingly.

form.yourGrid.objects.column1.datalink will get you the fieldname
form.yourGrid.objects.column1.editorControl.colorNormal will set the colour

You might also want to reset the headerControl.colorNormal....

Hope that helps,
Andy

> Hi Everyone
> I have a grid with beforecellpaint case statement attached to it.
> works exactly as planned.
> I now want to add to my case statement if the fieldname is eg "Mond1","Tued1" and the case statement does not cover it to change the color for it.
> I'm trying to achieve a color for M-F and a color for WE.
> Any suggestions are welcome
> Thanks Rob