Page 1 of 1

DynamicForeColor of Grid

Posted: Sat Jan 09, 2010 3:48 pm
by sudip
Hello Friends,

I have a grid with 3 columns. I am able to change forecolor of 3rd column based on the value of it. But I can't change forecolor of other columns based on the value of the 3rd column (which is a combobox control). Please check following image (I hide 1st column by setting it's with as zero)
grdAtten.jpg
grdAtten.jpg (53.21 KiB) Viewed 3082 times
I used following code

Code: Select all

fColor := { || if(this.cellvalue == 1, { 0, 0, 0 } , { 255,0,0 } )}
and set DynamicForeColor of the grid to

Code: Select all

{{||{0,0,0}}, {||{0,0,0}}, fColor}
Is it possible to change forecolor of 2nd column based on the value of the 3rd column?

Thanks in advance.

With best regards.

Sudip

Re: DynamicForeColor of Grid

Posted: Sun Jan 10, 2010 8:04 am
by mol
I'm using coloring in three ways of browse:

Code: Select all

	AForeColors := array(nLiczbaKolumn)
	ABackColors := array(nLiczbaKolumn)

	fkolor := { || if (zlec->Closed, {0,80,0}, {0,0,0} ) }
	bkolor := { || if (zlec->Closed, {200,240,200}, if( zlec->(ReadyForClose()), {240,240,50},  {255,255,255} ) ) }

	AFill(AForeColors, fkolor)
	AFill(ABackColors, bkolor)
where:
Browse.DynamicForeColor is set to AForeColors
and
Browse.DynamicBackColor is set to ABackColors
and everything works OK.
But i haven't got any example for grid...

Re: DynamicForeColor of Grid

Posted: Sun Jan 10, 2010 5:31 pm
by Roberto Lopez
sudip wrote: Is it possible to change forecolor of 2nd column based on the value of the 3rd column?
Theoretically yes :)

You should ask for the 3rd column value using 'cell' property.

Re: DynamicForeColor of Grid

Posted: Mon Jan 11, 2010 7:27 am
by sudip
Thanks a lot :)

I used

Code: Select all

Private fColor := { || if(getproperty("frmAtten", "grdAtten", "cell(this.RowIndex, 3)") == 1, ;
{ 0, 0, 0 } , { 255,0,0 } )}
But all rows became red :(

I am sure I made something wrong with calling GetProperty() function. ;)

With best regards.

Sudip

Re: DynamicForeColor of Grid

Posted: Mon Jan 11, 2010 11:04 am
by Roberto Lopez
sudip wrote:Thanks a lot :)

I used

Code: Select all

Private fColor := { || if(getproperty("frmAtten", "grdAtten", "cell(this.RowIndex, 3)") == 1, ;
{ 0, 0, 0 } , { 255,0,0 } )}
But all rows became red :(

I am sure I made something wrong with calling GetProperty() function. ;)

With best regards.

Sudip
Please, send me the complete sample to test for a possible bug.

Re: DynamicForeColor of Grid

Posted: Mon Jan 11, 2010 11:45 am
by sudip
Hello Master Roberto,

Thanks a lot. I am sending a small sample.
DynamicColor.zip
(1.82 KiB) Downloaded 302 times
Thanks in advance.

With best regards.

Sudip