Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DynamicBackColor in grid question
Message
From
28/08/2000 16:26:00
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00409939
Message ID:
00410006
Views:
32
>>Here's one example - ugly results, but...
>>
>>** custom form method GetBackColor()
>>Local lcDOW, lnretval
>>lcDOW = cdow(mytable.datefield)
>>do case
>> case inlist(lcDOW,"Monday", "Wednesday", "Friday")
>>  lnretval = rgb(0,0,255)
>> case inlist(lcDOW,"Tuesday", "Thursday")
>>  lnretval = rgb(0,255,0)
>> otherwise
>>  lnretval = rgb(255,0,0)
>>endcase
>>return lnretval
>>
>>** grid.Init()
>>this.setall("DynamicBackColor", "thisform.GetBackColor()", "Column")
>
>Wanted to suggest the same, Larry suggested, but hesitated for some reason :)
>
>Two additional questions:
>1) Can we return character from the function, e.g. str(lnRetVal) and call thisform.GetBackColor without quotes?

You can but it only evaluates the first record and sets the DynamicBackColor based on that.
e.g., in my example, my test data had the first day = Thursday, so they all got set green.

>2) Would it be slower than nested iif?

I tested with 50K records and showed no difference - both fired in no time. (Literally - 0.000 seconds)

>
>Thanks in advance.
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform