Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: surinder singh
  Where is surinder singh?
 mumbai
 India
 surinder singh
 To: Ellick Yeung
  Where is Ellick Yeung?
 
 Hong Kong
 Ellick Yeung
 Tags
Subject: RE: Text box fore color in a grid
Thread ID: 189072 Message ID: 189088 # Views: 1 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Grids
Date: Wednesday, August 13, 2008 11:04:56 AM         
   


> Your example will set the ForeColor for the ONE column "Column1", but what I am trying to do is just change the fore color of a single cell within the grid. Here is the example:
>
> Data shown in the grid as 3 columns and 3 rows.
>
> Col_a Col_b Col_c
> 100 200 500
> 150 70 500
> 20 300 600
>
> I want the value which is less than 100 show in RED, in this case Row 3 in Column A (value = 20) and Row 2 in Column B (value = 70).
>
> Thanks in advance!
>
> Ellick

if you want to set individual textbox's forecolor then you have to do it with gotFocus and
lostFocus events.

but if you want to highlight all the row where any of the columns value is less than 100
then you can try this code.


o = CREATEOBJECT("myForm")
o.show(2)
READ EVENTS
 
DEFINE CLASS myForm as Form 
	width = 500
	height = 500
	ADD OBJECT grd as grid WITH top =1,left =1,columncount=2,deletemark=.f.,recordsource="grdCursor",name="grd"
	PROCEDURE load
	CREATE CURSOR GrdCursor(amt1 i,amt2 i)
	INSERT INTO GrdCursor values(150,100)
	INSERT INTO GrdCursor values(20,100)
	INSERT INTO GrdCursor values(150,20)
	PROCEDURE init
		thisform.grd.setAll("dynamicforecolor","iif((amt1<100 or amt2<100),RGB(255,0,0),RGB(0,0,0))","Column")
	ENDPROC 	

	PROCEDURE unload
		CLEAR EVENTS 	

ENDDEFINE 





-----------------------------------------------------------------------------------------------
Regards
Surinder Singh
Email: sur200@indiatimes.com
Check my blog for details: http://weblogs.foxite.com/sur200
----------------------------------------------------------------------------------------
*If you understand what you're doing, then you're not learning anything.

ENTIRE THREAD

Text box fore color in a grid Posted by Ellick Yeung @ 8/13/2008 9:52:10 AM
RE: Text box fore color in a grid Posted by Stefan Wuebbe @ 8/13/2008 10:08:26 AM
RE: Text box fore color in a grid Posted by Ellick Yeung @ 8/13/2008 10:55:26 AM
RE: Text box fore color in a grid Posted by surinder singh @ 8/13/2008 11:04:56 AM
RE: Text box fore color in a grid Posted by Stefan Wuebbe @ 8/13/2008 12:17:42 PM
RE: Text box fore color in a grid Posted by Jun Tangunan @ 8/13/2008 1:13:57 PM
RE: Text box fore color in a grid Posted by Ellick Yeung @ 8/14/2008 4:56:36 AM
RE: Text box fore color in a grid Posted by surinder singh @ 8/13/2008 10:09:56 AM
RE: Text box fore color in a grid Posted by Mustapha Bihmouten @ 8/13/2008 10:11:24 AM
RE: Text box fore color in a grid Posted by Jun Tangunan @ 8/13/2008 10:14:53 AM