Page 1 of 1

DynamicColor of one Column depending on other Column

Posted: Thu Jan 14, 2010 3:11 pm
by sudip
Hello Friends,

This is the smallest and the simplest project I want to share with you ;) . But, forgive me, I can't just resist myself to share the very simple solution I got (thinking 3/4 days :o :lol: ), with you :)

I forgot to mention, this small sample was created from tips by Master Roberto Lopez. Thank you master :)

I want to change DynamicForeColor of a Column of a Grid depending on the value of another column of the same grid.
DynColor.jpg
DynColor.jpg (29.3 KiB) Viewed 3551 times
Here is the source code
DynamicColor.zip
(2.48 KiB) Downloaded 393 times
With best regards.

Sudip

Re: DynamicColor of one Column depending on other Column

Posted: Thu Jan 14, 2010 4:15 pm
by Rathinagiri
Hi Sudip,

Thanks for sharing. :)

Re: DynamicColor of one Column depending on other Column

Posted: Thu Jan 14, 2010 4:20 pm
by Roberto Lopez
sudip wrote:Hello Friends,

This is the smallest and the simplest project I want to share with you ;) . But, forgive me, I can't just resist myself to share the very simple solution I got (thinking 3/4 days :o :lol: ), with you :)

I want to change DynamicForeColor of a Column of a Grid depending on the value of another column of the same grid.
DynColor.jpg
Here is the source code
DynamicColor.zip
With best regards.

Sudip
If you are trying to change the forecolor for column 2 based on column 2 content:

Please, replace your DynColor function with this:

Code: Select all

Function DynColor(mRow, mCol)
local r

	if mCol == 2 

		if frmAtten.grdAtten.cell(mRow, 2) = 1

			r := {0, 0, 0}

		else

			r := {0, 255, 0}

		endif

	else

		r := {0, 0, 0}		

	endif

return r

If you are trying to change the forecolor for column 1 based on column 2 content:

Please, replace your DynColor function with this:

Code: Select all

Function DynColor(mRow, mCol)
local r

	if mCol == 1

		if frmAtten.grdAtten.cell(mRow, 2) = 1

			r := {0, 0, 0}

		else

			r := {0, 255, 0}

		endif

	else

		r := {0, 0, 0}		

	endif

return r


Re: DynamicColor of one Column depending on other Column

Posted: Thu Jan 14, 2010 5:13 pm
by sudip
Hello Master Roberto,

Thanks a lot for checking this small sample and for your tips :)
My original sample was also built on your tips :)

Thank you again.

Rahi, it's the beauty of HMGForum that creator of very small things (like me), also encouraged to do better :) Thank you :)

If someone asks me what is the best thing of Clipper and Harbour, I will say, "Code Block". But, unfortunately I am not very easy with it ;)

With best regards.

Sudip