DynamicForeColor of Grid

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

DynamicForeColor of Grid

Post 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 3075 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
With best regards,
Sudip
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: DynamicForeColor of Grid

Post 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...
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: DynamicForeColor of Grid

Post 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.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: DynamicForeColor of Grid

Post 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
With best regards,
Sudip
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: DynamicForeColor of Grid

Post 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.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
sudip
Posts: 1456
Joined: Sat Mar 07, 2009 11:52 am
Location: Kolkata, WB, India

Re: DynamicForeColor of Grid

Post by sudip »

Hello Master Roberto,

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

With best regards.

Sudip
With best regards,
Sudip
Post Reply