Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: John Hayna
  Where is John Hayna?
 
 Philippines
 John Hayna
 To: Mike Gagnon
  Where is Mike Gagnon?
 Pointe Claire
 Canada
 Mike Gagnon
 Tags
Subject: RE: Grid's forecolor
Thread ID: 330955 Message ID: 331030 # Views: 45 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Grids
Date: Monday, December 26, 2011 2:57:17 AM         
   


Hi Mike,

Thanks for the reply and Happy Christian Holiday to you and to your family.

Below is my code. I have a two select statements and after that I joined the two select to get the onhand and low_lvl of the items in one cursor table to run a condition for comparison of the onhand versus low_lvl.

Note:
curMeds is a cursor table binded in the grid of the select item form.

The problem with this code is:
It shows everything in the grid in forecolor RED :(

select itemcode, onhand from curMeds INTO CURSOR xLow2

        m.lcActive = 1
	SQLEXEC(m.dataConn,"select itemcode, low_lvl from products where active = ?m.lcActive","xLow1")

	 
	SELECT t1.lowlvl as low1, t1.itemcode as icode, t2.itemcode as itcode, t2.onhand as low2;
	FROM xLow1 t1;
	LEFT JOIN xLow2 t2 ON t1.itemcode = t2.itemcode;
	WHERE t1.itemcode = t2.itemcode;
	INTO CURSOR crsIfLowThenRed
  	
	thisform.grid1.SetAll("dynamicforecolor", ;
			"IIF(crsIfLowThenRed.low2 < crsIfLowThenRed.low1, RGB(255,0,0), RGB(0,0,0))", "Column")


Thanks in advance.

> > Hi all,
> >
> > I am new in this forum and I quite need your help.
> >
> > I have a grid where employees will browse items to sell for my POS software. I want the forecolor of the certain row to be RED when the item is low in stocks. I have a low_level column in my products table where I can compare the current onhand versus the value in the low_level column, comparing them will determine if the product is low in stocks, I can do this, what I do not know is how to make the forecolor of that record in the grid to be RED. Can you guys help me sort things out?
> >
> > Thanks in advance
>
> Look at 'solutions' that comes with foxpro
>
>
oGrd.SetAll("dynamicforecolor", ;
> 			"IIF(discontinu, RGB(192,192,192), RGB(0,0,0))", "Column")

>
> Mike Gagnon
> Refox XI +(English version)

ENTIRE THREAD

Grid's forecolor Posted by John Hayna @ 12/24/2011 9:00:42 PM
RE: Grid's forecolor Posted by Mike Gagnon @ 12/25/2011 2:05:43 AM
RE: Grid's forecolor Posted by John Hayna @ 12/26/2011 2:57:17 AM
RE: Grid's forecolor Posted by Jun Tangunan @ 12/26/2011 3:33:04 AM
RE: Grid's forecolor Posted by John Hayna @ 12/26/2011 7:58:35 AM
RE: Grid's forecolor Posted by Jun Tangunan @ 12/27/2011 6:36:38 AM
RE: Grid's forecolor Posted by John Hayna @ 12/27/2011 7:46:20 AM
RE: Grid's forecolor Posted by Jun Tangunan @ 12/27/2011 11:44:48 PM
RE: Grid's forecolor Posted by Mike Gagnon @ 12/25/2011 2:10:47 AM