Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with DynamicBackColor
Message
From
10/11/2020 06:22:34
 
 
To
09/11/2020 14:50:06
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01677077
Message ID:
01677082
Views:
63
>Hi,
>
>I have a grid where the user picks a "type" in the first column and then based on that, certain columns are skipped for the rest of the grid. To make it obvious, I also change the backcolor of those columns to be grey to visually signal they cannot be edited any longer. I use DynamicBackColor for this something like:
>
>grid.Column5.DynamicBackColor = "IIF(AnnuityType='Life',RGB(255,255,255),RGB(220,220,220))"
>
>- it works great 98% of the time
>- if I start with a grid populated with data, it works
>- if the user changes the type from "Life" to something else, it works
>- if I add a row to the grid (via a button), it works
>
>But it does not work if:
>
>- I start with a blank grid upon form startup and then add a row
>- for this instance, if I add a row and save the changes and reload the form, it works
>
>I don't have anything in my expression to evaluate the record number or primary key etc. that would be affected by starting the grid with no records.
>
>In the help file, it says the dynamic back color is reevaluated every time the grid is refreshed - so I force this at the bottom of my code that fires when the user changes the "type". I did not see any bug listed in the help file (the updated one) or kilo-fox. I also tried refreshing the individual columns instead of the grid as a whole and that did not help.

Is it possible that the way you're adding the first row, you're actually reconstructing the RecordSource for the grid? Grids lose all their customization if you change their RecordSource.

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform