Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid DynamicBackColor trick
Message
From
09/04/2001 18:10:12
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
To
07/04/2001 09:26:10
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00492054
Message ID:
00493823
Views:
21
>>
>>this.setall("DynamicBackColor",;
>>   "iif(ascan(thisform.aOrder,"+;
>>   "recno())%2=0,"+tran(rgb(0,255,0))+;
>>   ","+tran(rgb(255,255,0))+")","Column")
>>This way there's two function calls (even if it's such a simple function as rgb() in the expression.
>>In the framework we use there was a method call in the dynamicbackcolor expression; the method was just a five-liner, if [expression] - return this.backcolor - else - return thisform.backcolor - endif. Just replacing the method call with an iif() expression containing constants sped it up incredibly. The difference was really visible in the debugger, it was like "oh no it's refreshing again, lemme get some coffee until it finishes" compared to "ok, one, two, here it is".
>
>Good Dragan,
>Then you could also make it shorter and increase support count to 65000*2 recs for an array.
>
>-First select into a cursor
>-Select only odds or evens into array
>-Change expression to something like :
>
'(ascan(recno())*'+tran(myColor1-myColor2)+tran(myColor1)+')'
>No iif() too :)
>Say I put only odd ones in array and oddcolor=120000, evencolor=100000
>(ascan(recno())*20000+(100000)
>Cetin

Of course, the best you can do is influence the process of creating the cursor in the first place, and add an integer column with actual color number. Then there's no iif, noarrays and no function at all, and you can use all the colors you like:
>
'tran(myColorField)'
>No iif() too :)
Nothing at all :)

back to same old

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

Click here to load this message in the networking platform