Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Colouring a row on a grid
Message
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00062613
Message ID:
00062754
Views:
23
>How do I colour a specific row in grid? DynamicBackColor is used for columns not rows.
>
>I will like to colour each row based on the value of the data in a field on each row.

Evan,

I've used this in an app I'm working on at the moment set the ColumnDynamicBackColor to:

thisform.StageColor(recno("stackstages"))

With this Form.StageColor() method:

* 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

In this case the grid only displays 5 rows, but it keeps you from having to to create some monsterous IIF()
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