Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SetAll and grid DynamicBackcolor question
Message
From
15/05/2004 12:57:17
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
15/05/2004 06:11:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00904211
Message ID:
00904351
Views:
16
>Change to :
>
>DynamicBackColor is a Character expression
>
>thisForm.pgfpagerefresh1.page4.Grdtmdataentry1.SetAll("DynamicBackColor", "thisform.zGridColor()", "Column" )	
>
>
>The evaluation of the DynamicBackColor expression must return a Color value
>
>* cColor = "RGB(255,255,255)"	 && useless
>DO CASE
>   CASE taskcomp	                  && done... GREEN
>      RETURN RGB(215,255,215)
>   CASE EMPTY(taskend) AND taskbeg <= DATE() + 9
>      RETURN IIF(taskbeg <= DATE() + 2,RGB(255,222,213),RGB(250,253,193))
>   OTHERWISE
>      RETURN  RGB(255,255,255)  	&& white
>ENDCASE
>
>
>If you use a IIF(,IIF(,... expression you can remove the zGridColor method.

And if you're debugging this, each refresh of the grid would last as a decent coffee break. Why? Because the refresh of each cell now involves a method call. But one can still have the same effect, blazingly fast.

A rgb() value is an integer, right? So, add a field to hold it. Assuming the underlying alias of the grid is a cursor, we can always add one extra field, call it nBackColor. Then the code looks like this:
replace all nBackColor with this.zGridColor()
thisForm.pgfpagerefresh1.page4.Grdtmdataentry1.SetAll("DynamicBackColor", "nBackColor", "Column" )
This was tried and tested as early as VFP6 (but it should work even in 3.0) and the grid was extremely fast to repaint, even with the then 200 MHz machines.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform