Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic dynamicbackcolor?
Message
From
04/06/2001 12:33:50
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
04/06/2001 12:32:27
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00513208
Message ID:
00514658
Views:
10
OK, I've closed the missing < /pre > tag, this is probably a little more readable now.

>>Your expression would be too complex to use SetAll(). Don't use it. Instead you can set it like in this 'sample' :
>>
>>
>>for each oColumn in this.Columns
>> with oColumn
>>   .DynamicBackColor = 'iif(inlist('+;
>>   str(.ColumnOrder)+',1,5,7) or type('+;
>>   .ControlSource+') = "C", rgb(255,255,0), rgb(0,255,255))'
>> endwith
>>endfor
>>
>
>Since the dynamic properties in grids actually use an equivalent of Eval(), and they are re-evaluated for each cell on each refresh, I tend to be as picky as possible not to involve function calls, or method calls as well. Now, since RGB() is a function, yielding an integer, and we're building a string... and rgb(255,255,0) will always be the same number, let's insert this number instead:
>
>
>   .DynamicBackColor = 'iif(inlist('+;
>   str(.ColumnOrder)+',1,5,7) or type('+;
>   .ControlSource+') = "C",'+tran(rgb(255,255,0))+','+tran(rgb(0,255,255))+')'
>
>I'd also gladly omit the outer iif, and build two different strings instead, one for columns 1, 5 and 7, and another for the others. One less to recalculate for each cell.
>
>>
* Assuming color determining method is in grid class
>>for each oColumn in this.Columns
>> oColumn.DynamicBackColor = '(this.SetColor("'+oColumn.Controlsource+'"))'
>>endfor
>
>I've had this in the framework we use, and it was just too slow. Not visibly slow, though, but a real pain if you debugged. Any refresh would cause about forty calls to this method. On slower machines, you didn't even need the debugger to see this slow down.
>
>Now since many of us are showing cursors in grids, there's a simple way to have as many colors as you like: have the color numbers in a separate column (or more columns) in the same cursor, and simply set the dynamic*color to "alias.field". Works like a charm, and the speed is great. Besides, you can make your grids as coloured as you like.
>
>Just my 0.02 of... whatever.

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