I can't succeed dynamically set/changing back and fore colors of GRID cells.
Here my unsucceed code :
Code: Select all
#include "minigui.ch"
PROC Main()
PRIV aGrdDFC := ARRAY( 3 ) // GRID Dynamic Fore Colors
aCitizens := {}
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 500 ;
HEIGHT 400 ;
TITLE 'Test Dynamic Colors' ;
MAIN ;
ON INIT FillGrid()
DEFINE GRID Grid_1
ROW 10
COL 10
WIDTH 450
HEIGHT 330
HEADERS {'Last Name','First Name','Phone'}
WIDTHS {140,140,140}
ITEMS { { '','',''} }
VALUE 1
END GRID
END WINDOW
Form_1.Center
Form_1.Activate
RETU // Main()
*------------------------------------------------------------------------
PROC FillGrid()
LOCA aItems :={ {'Simpson','Homer','555-5555' },;
{'Mulder','Fox','324-6432'},;
{'Smart','Max','432-5892'},;
{'Grillo','Pepe','894-2332'},;
{'Kirk','James','346-9873'},;
{'Barriga','Carlos','394-9654'},;
{'Flanders','Ned','435-3211'},;
{'Smith','John','123-1234'},;
{'Pedemonti','Flavio','000-0000'},;
{'Gomez','Juan','583-4832'},;
{'Fernandez','Raul','321-4332'},;
{'Borges','Javier','326-9430'},;
{'Alvarez','Alberto','543-7898'},;
{'Gonzalez','Ambo','437-8473'},;
{'Batistuta','Gol','485-2843'},;
{'Vinazzi','Amigo','394-5983'},;
{'Pedemonti','Flavio','534-7984'},;
{'Samarbide','Armando','854-7873'},;
{'Pradon','Alejandra','???-????'},;
{'Reyes','Monica','432-5836'} }
Form_1.Grid_1.DeleteAllItems()
AEVAL( aItems, { | a1 | Form_1.Grid_1.AddItem( a1 ) } )
AEVAL( aItems, { | a1 | AADD( aCitizens, LEFT( a1[ 3 ], 1 ) == "5" ) } )
AFILL( aGrdDFC, { || IF( aCitizens[ This.CellRowIndex ], RED, GREEN ) } )
*** Form_1.Grid_1.DynamicForeColor := aGrdDFC => syntax error at '.'
SetProperty ( 'Form_1', 'Grid_1', 'DYNAMICFORECOLOR', aGrdDFC )
RETU // FillGrid()
Regards
--
esgici