Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic color change in grids anyone
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00341857
Message ID:
00341862
Views:
22
Hi Stephen

>I ws wondering if anyone was using a dynamic color for easy understandig of a grids data?
>I have a signature loan customer who will take 5 to 10 payments on a loan. I want to show in a grid for payments where the customer stands.
>Issues that come to mind are past late payments in a blue color, current payment in red and special extensions in green.
>Where would I put in the flaging for various colors? Should I add a column in the view that I record the color? That way every time in the future it's already done?
>Next is how would I change the color? I the page.activate pem ?

In the Refresh() method of your grid, enter the following code:
This.SetAll( "DynamicForeColor", "IIF( NumOfPayments >= 8, RGB(255,0,0), IIF( NumOfPayments >= 6, RGB( 255, 255, 255 ), 0 ) )", "Column" )
The above code sets the Foreground color to red for cases where the NumOfPayments variable is >= 8, white if more than 6, and black for all the rest. Of course, you can also set the background color in the same manner ( just change the DynamicForeColor clause above with DynamicBackColor. Also, you can play with the IIF statements to create more complicated conditions.
Since this is in the Refresh method, any change in the data will trigger it, or just issue a refresh in your code whenever you want your colors updated.
I would also recommend to lock the screen painting before this line, and unlocking it afterwards if you're going to use many colors.

Best regards
Jaime
Why do programs stop working correctly as soon as you leave the Fox?
Previous
Reply
Map
View

Click here to load this message in the networking platform