Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid dynamicbackcolor please
Message
 
À
20/04/2006 05:06:54
Suhas Hegde
Dental Surgeon
Sirsi, Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
01114862
Message ID:
01114871
Vues:
15
>>>hi,
>>>
>>>I have grid class with a textbox class in it
>>>
>>>i want to change the dynamic back color of the individual cells when the value of the cells change
>>>
>>>i.e. if more to green or if less to red
>>>
>>>i want to set it to all cells in the grid
>>>
>>>need help
>>>
>>>suhashegde
>>
>>For one or for all columns?
>
>for all columns
FOR EACH oCol IN thisform.Grid12.Columns
    oCol.DynamicBackColor = [IIF(]+oCol.ControlSource+[ > 0, RGB(0,255,0), RGB(255,0,0))]
NEXT
Of course this is only if all columns have numeric fields as control source.

Here an example
PUBLIC oForm1

oForm1=NEWOBJECT("form1")
oForm1.Show
RETURN

DEFINE CLASS form1 AS Form


	DoCreate = .T.
	lbopenconfig = .F.
	Name = "form1"


	ADD OBJECT grid1 AS grid WITH ;
		Height = 200, ;
		Left = 21, ;
		Top = 39, ;
		Width = 320, ;
		Name = "Grid1"


	PROCEDURE Init
		FOR EACH oCol IN thisform.Grid1.Columns
		    oCol.DynamicBackColor = [IIF(]+oCol.ControlSource+[ > 0, RGB(0,255,0), RGB(255,0,0))]
		NEXT
	ENDPROC


	PROCEDURE Load
		CREATE CURSOR crsTest (Fld1 I, Fld2 I, Fld3 I)
		FOR asd = 1 TO 20
		    INSERT INTO crsTest VALUES (asd, -asd,asd * IIF(asd%2==0,1, -1))
		NEXT
		GO TOP
	ENDPROC


ENDDEFINE
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform