Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic Grid Colors
Message
From
05/09/2002 10:12:59
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
05/09/2002 08:55:37
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00697013
Message ID:
00697047
Views:
20
>Hello All...
>
>I was playing around with the DynamicBackColor property in a Grid and have managed to get the columns to alternate colors between rows depending on the RECNO(). Is there a way, and what would the syntax be for updating the color of a row based on values in each record. I would also like to assign a new color to a row if any of the text boxes in that row are clicked by the user. Any input would be helpful. Thanks in advance.
>
>Baron Morvant

Baron,
Just like recno() expression. ie: If you want to set all row to blue if myField value is 'Baron' then your expression would be like :

this.Setall('DynamicBackcolor', ;
'iif(myAlias.myField="Baron",rgb(0,0,255),rgb(255,255,255))')

If your expression gets a bit complex then use a method instead (it's easy to write complex expressions wrong and Dynamic* wouldn't error). ie:
*Grid.init
for each oCol in this.Columns
 oCol.DynamicBackcolor = "(thisform.GetMeColor('"+oCol.Controlsource+"'))"
endfor

* Form.Getmecolor
lparameters tcControlSource
do case
  case lower(tcControlsource) == 'somealias.somefield' ;
    and eval(tcControlsource) = 'SomeValue'
    return 0xFFFF00
  case Soemthing
    ....
  otherwise
    return 0xFFFFFF
endcase
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