Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine X,Y of grid for DynamicBackColor
Message
 
À
10/12/2003 09:21:35
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00857594
Message ID:
00857932
Vues:
23
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().
* my_color.prg
*... 
* code that calculates the value here, or a parameter passing tnValue
*...
tnValue &&  your calculated value
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform