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: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 Tags
Subject: RE: Grid's forecolor
Thread ID: 330955 Message ID: 331131 # Views: 34 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Grids
Date: Tuesday, December 27, 2011 7:46:20 AM         
   


Hi John,

What do you mean by "don't need to set that DynamicForeColor on every run of your SQL."? Am I doing it? :-U

I didn't know that I'm doing it. So how to approach it to don't set it every run of SQL?

Thanks.

> > Hi Jun,
> >
> > Thanks for the reply. Please see attached screenshot for the cursor's result.
> >
> >
> > low1 = 50 as this is the setting entered in the inventory for each product, that low_lvl or reorder point is 50.
> > low2 = variable, this is the current available stocks of the products or onhand. There is one item in the grid that is above the low_lvl value so it must not show in RED font, but running the code I posted in this thread turns all rows the grid into RED.
> >
> > Thanks.
> >
>
>
> I am not sure why John because the DynamicForeColor condition is valid. Try this:
>
>
Local oForm As Form
> oForm = Createobject('TestForm')
> oForm.Show(1)
> Return
> 
> Define Class TestForm As Form
>     AutoCenter = .T.
>     Height = 500
>     Width = 390
>     Caption = "DynamicForeColor"
> 
>     Add Object grid1 As Grid With ;
>         Left = 10, Top = 45, Width = 370, Height = 420, ColumnCount = 2,;
>         deletemark = .F., ScrollBars = 2
> 
>     Procedure Load
>         Create Cursor junk ( low1 i, low2 i)
>         RAND(-1)
>         FOR lnloop = 1 TO 20
>            INSERT INTO junk VALUES (50,1 + 100 * RAND( ))
>         NEXT 
>         GO TOP 
>    Endproc
> 
>     Procedure Init
>         With Thisform.grid1 As Grid
>         .SetAll("dynamicforecolor", "IIF(low2 < low1, RGB(255,0,0), RGB(0,0,0))", "Column")
>         Endwith
>     Endproc
> 
> Enddefine
> 
> 

>
>
> And like I told you, you don't need to set that DynamicForeColor on every run of your SQL. Set it once and it will act properly throughout your usage. To test, when the sample form runs, try manually changing the values and see how the grid will quickly react into that without additional codes.
>
>
> http://sandstorm36.blogspot.com
> http://weblogs.foxite.com/sandstorm36/default.aspx

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