Subject Re: Grid Fieldname
From Rob Rickard <rob@nospam.calculation.com.au>
Date Sat, 30 Apr 2022 19:25:19 -0400
Newsgroups dbase.getting-started

Hi Andy And Akshat
Thanks for your replies
i ended up taking an easy way out and created 2 beforecellpaint instances.
1 for for the M-F instance
2nd  one for the w/e instances
the grid changes everytime an employee changes details during the program. Its a roster program

Regards Rob


Andy Taylor Wrote:

> 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
>