> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Peter Cushing > Sent: Tuesday, February 13, 2007 7:39 AM > To: [EMAIL PROTECTED] > Subject: Re: VFP 9, Grid highlighting > > Jeff Johnson wrote: > > Sytze: Here is an example of a grid that is highlighted one of six > > different colors based on vtank.cur_ostat. This code is the .init of > the > > grid. This takes care of everything with respect to highlighting and > there > > is no performance problem because of the nested IIF's. > > > > > <snip> > > .SetAll("DynamicBackColor", ; > > "IIF(RECNO(THIS.RecordSource) = THIS.ncurrentrecord," + ; > > "THIS.gridactivebackcolor," + ; > > "IIF(vtank.cur_ostat = 'S'," + ; > > "RGB(0,255,0)," + ; > > "IIF(vtank.cur_ostat = 'A'," + ; > > "RGB(0,200,0)," + ; > > "IIF(vtank.cur_ostat = 'D'," + ; > > "RGB(0,128,0)," + ; > > "IIF(vtank.cur_ostat ='W'," + ; > > "RGB(255,0,0)," + ; > > "IIF(vtank.cur_ostat = 'C'," + ; > > "RGB(0,0,255)," + ; > > "THIS.griddefaultbackcolor))))))", ; > > "COLUMN") > > > Hi Jeff, > I needed to do something similar with a grid and thought of doing this > but didn't like how messy it got. I tried to use a form method but > could not get it to work. Now I have a function in my procedure file > that returns a colour string based on certain conditions. I use this > code in the init: > thisform.pf.page3.grdmilestone.SetAll("DynamicBackColor", ; > "evaluate(getcolour())", "Column") > > Peter >
Peter: I went to one of Andy Kramek's sessions at Whilfest one year on optimization of VFP. While the nested IIF's can get messy, they are significantly faster than CASE, IF-ELSE-ENDIF or using a UDF. I find the indention above works for me. Jeff Jeff Johnson [EMAIL PROTECTED] 623-582-0323 Fax 623-869-0675 --- StripMime Report -- processed MIME parts --- multipart/signed text/plain (text body -- kept) application/x-pkcs7-signature --- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

