Hi Larry
I assume that you have some user defined function that calculates the attribute. Are these attributes calculated from data displayed in grid? If so, you possibly could add a call to another function, that returns the corresponding color (or combine the code into one function). Then you can set the DynamicBackColor IIF expression (for one or more column) which will call that user defined function.
For example, let's say, you have a custom function my_color().
tnValue
LOCAL lnColor
DO CASE
CASE tnValue = 3
lnColor = RGB(0,255,255)
CASE tnValue = 4
lnColor = RGB(255,0,0)
CASE tnValue = 5
lnColor = RGB(0,255,0)
CASE tnValue = 6
lnColor = RGB(0,0,255)
CASE tnValue = 7
lnColor = RGB(255,255,0)
OTHERWISE
lnColor = RGB(255,255,255)
ENDCASE
RETURN lnColor
Put into the one or more column DynamicBackColor expression that will call the UDF:
"IIF(.T.,my_color(), "")
I don't know the particulars of your calculations and other details, but you may get an idea. You may not even use an array with the attributes, doing the necessary calculation on the fly.
>I have a calculated attribute similar to FieldState for each value in a cursor and want to be able to change the background for each cell based the value of this attribute.
>
>Thanks,
>Larry
>
>>Hi Larry.
>>
>>
I am trying to set the BackColor of a grid cell based on a calculated value (similar to FieldState). I currently have the calcualted values in an array with one element corresponding to each field in the cursor. My idea is to put a function in DynamicBackColor that uses the grid's X,Y position to refer back to the associated array.>>
>>Rather than talking about how you are trying to implement this, it might be better to tell us what you are trying to accomplish. Then we can help you figure out the best way to implement.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison