Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Binod Binani
  Where is Binod Binani?
 Kolkata
 India
 Binod Binani
 To: Glen Villar
  Where is Glen Villar?
 Palayan City
 Philippines
 Glen Villar
Subject: RE: Grids Rows Two Color
Thread ID: 187638 Message ID: 187733 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Grids
Date: Tuesday, August 5, 2008 4:30:34 PM         
   



> > In a grid i have populated a table having fields and data as under:
> >
> > dates Qnty
> > 18.7.2008 10000
> > 19.7.2008 -8000
> > 21.7.2008 9000
> > 22.7.2008 11500
> > 23.7.2008 -1500
> > 24.7.2008 4500
> >
> > Grid1.colum1.controlsource='mytable.dates'
> > grid2.colum2.controlsource='mytable.qnty'
> >
> > I wish to change the backcolor and forecolor should be different
> > where qnty is negative.Both text are readonly and enabled = .f.
> >
> > is it possible.
> >
> >
> > Please help.
> >
> > thanx in advance.
> >
> >
> >
> >
> > *Exchange of $1 Create only $1, But Exchage of one Ideas Makes different two Ideas*
>
> Hi Binod!
>
> The secret (not a secret actually :-) ) there is the Grid's Dynamic Back Color. Copy this into a PRG then Run. Hope this helps.
>
>
> o = Createobject("FrmTest")
> o.Show
> Read Events
> Set Safety Off
> 
> 
> Define Class FrmTest As Form
> 	Height = 300
> 	Width = 200
> 	AutoCenter = .T.
> 
> 	Add Object GrdRecords As Grid With;
> 		Height = 200, Width = 150, Left = 30, Top = 20,;
> 		AllowCellSelection = .F., ScrollBars = 2, DeleteMark = .F.
> 
> 
> 	Procedure Init
> 	This.GrdRecords.RecordSource= 'tbTest'
> 	Thisform.GrdRecords.SetAll("DynamicBackColor", ;
> 		"IIF(tbTest.Qty<0, RGB(169,204,157), RGB(255,255,255))", "Column")
> 	Go Top In('tbTest')
> 	Endproc
> 
> 	Procedure Load
> 	Create Table tbTest(Dates d(8), Qty N(10,0))
> 	Insert Into tbTest(Dates, Qty) ;
> 		VALUES ({^2008/07/18}, 10000)
> 	Insert Into tbTest(Dates, Qty) ;
> 		VALUES ({^2008/07/19}, -8000)
> 	Insert Into tbTest(Dates, Qty) ;
> 		VALUES ({^2008/07/21}, 9000)
> 	Insert Into tbTest(Dates, Qty) ;
> 		VALUES ({^2008/07/22}, 11500)
> 	Insert Into tbTest(Dates, Qty) ;
> 		VALUES ({^2008/07/23}, -1500)
> 	Insert Into tbTest(Dates, Qty) ;
> 		VALUES ({^2008/07/24}, 4500)
> 	Endproc
> 
> 
> 	Procedure KeyPress
> 	Lparameters nKeyCode, nShiftAltCtrl
> 	If nKeyCode = 27
> 		Release Thisform
> 	Endif
> 
> 	Procedure Destroy
> 	Clear Events
> 	Endproc
> 
> 
> Enddefine

>
>
> (coffee)


Thanx Mr Glenn

It worked but only when colums are enabled. But All all colums are enabled=.f..
how ever , I had rectified my codes as the syntex was wrong. I was using
iif(qty > 0,rgb(0,0,0),rgb(255,0,0) which should be within ""

Thanx a Lot.

*Exchange of $1 Create only $1, But Exchage of one Ideas Makes different two Ideas*

ENTIRE THREAD

Grids Rows Two Color Posted by Binod Binani @ 8/5/2008 7:35:24 AM
RE: Grids Rows Two Color Posted by Erik Gomez @ 8/5/2008 7:46:34 AM
RE: Grids Rows Two Color Posted by Binod Binani @ 8/5/2008 4:32:25 PM
RE: Grids Rows Two Color Posted by Erik Gomez @ 8/6/2008 4:53:02 AM
RE: Grids Rows Two Color Posted by Glenn Villar @ 8/5/2008 8:11:11 AM
RE: Grids Rows Two Color Posted by Binod Binani @ 8/5/2008 4:30:34 PM
RE: Grids Rows Two Color Posted by Cetin Basoz @ 8/5/2008 9:27:39 AM
RE: Grids Rows Two Color Posted by Binod Binani @ 8/5/2008 4:27:00 PM
RE: Grids Rows Two Color Posted by Anil Sharma @ 8/10/2008 1:50:24 PM
RE: Grids Rows Two Color Posted by Binod Binani @ 8/11/2008 8:32:09 AM