Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic dynamicbackcolor?
Message
From
31/05/2001 15:16:18
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00513208
Message ID:
00513367
Views:
14
>I have a grid with 14 columns. The backcolor of 4 of the columns is grey. Now I need to set the backcolor of the other 10 columns dynamically based on data. In the init of the grid I have:
>
>This.SetAll("DynamicBackColor", "IIF(items.secondary, RGB(193,255,255),RGB(255,255,255))", "Column")
>
>But of course this sets the columns that should be grey to white. I cannot figure out how to write the code to account for those 4 columns and keep they grey.
>
>Any suggestions?
>
>TIA!
>
>Rob

Rob,
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
Would set columns with 'ColumnOrder' 1,5,7 or field char type to yellow and rest cyan (full column setting). If you need you could add rowwise limitations too.
However if your expression gets complex then it's better to do it like :
* Assuming color determining method is in grid class
for each oColumn in this.Columns
 oColumn.DynamicBackColor = '(this.SetColor("'+oColumn.Controlsource+'"))'
endfor

*SetColor
lparameters tcControlsource && At runtime this method would get controlsource
if tcControlsource is something
if eval(tcControlsource) is some value
etc
Please note that this is much different from SetAll.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform