Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Row Color
Message
 
 
To
17/05/1998 06:33:35
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00099843
Message ID:
00099995
Views:
17
Rick,

You can call a function or method if you have a complex coloring function. For example I have a grid where the first column has 1 of 5 colors so the Column1.DynamicBackColor is set to thisform.StageColor(recno("stackstages")) on the property sheet. And the form method looks like:

* this method provides the colored cells for the grdStages
* they match the colors of the pages from the stack ticket

lparameter pnRecno

do case
   case ( pnRecno = 1 )            && Yard
      return rgb( 255, 255, 255 )
   case ( pnRecno = 2 )            && Pre Dryer
      return rgb( 255, 255, 0 )
   case ( pnRecno = 3 )            && Kiln
      return rgb( 255, 128, 255 )
   case ( pnRecno = 4 )            && Cooling Shed
      return rgb( 255, 128, 0 )
   case ( pnRecno = 5 )            && Plant
      return rgb( 255, 255, 164 )
   otherwise
      return rgb( 192, 192, 192 )
endcase


>>Hi Rick,
>>
>>To elaborate a bit on Ed's response,<s> I am sure you would like to see an example of how DynamicBackColor and DynamicForeColor Properties work.
>>
>>This example toggles the backcolor of a column based on whether the value of recno() is even or odd: Iif(mod(recno(),2)=0,rgb(255,0,0),rgb(255,255,255)). In code, you would do something like:
>>
>>frmFoo.Grid1.Column1.DynamicBackColor = ;
>> "Iif(mod(recno(),2)=0,rgb(255,0,0),rgb(255,255,255))"
>>
>>Or... you can issue this code:
>>
>>frmFoo.Grid1.Setall("dynamicbackcolor", "Iif(mod(recno(),2)=0,rgb(255,0,0),rgb(255,255,255))","column")
>>
>>Just replace the Iif expression with the logical value stored in the table.
>
>
>OK,
>
>BUT , how about multiple row color ??
>
>eg. when xx=1 then color=red
> when xx=2 color=bleu
> xx=3 color=green
>...
>
>Greetings,
>
>Marc
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform