Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 To: Johnny Quest
  Where is Johnny Quest?
 Ocala
 Florida - United States
 Johnny Quest
 Tags
Subject: RE: my CASE or ICASE won't work VFP9
Thread ID: 416528 Message ID: 416544 # Views: 43 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Tuesday, December 30, 2014 10:03:04 PM         
   


> >
> > You won't get any errors in the dynamicxxx properties, they just won't run. If you took a minute to read Help, you would see that Icase() doesn't support the Otherwise keyword.
> >

> > Thisform.pgfrm.Page1.grid1.SetAll("DynamicBackColor", ;
> > [ICASE(catorder=[CX], RGB(0,255,64), ;
> > catorder=[IN], RGB(0,255,255),;
> > catorder=[PP], RGB(255,128,128),;
> > RGB(255,255,255))])

> >
> > Also your code for gridcolors() is wrong, wrong, wrong! Plus I would say that it's a function, not a procedure. A function returns a value, a procedure does not.
> >

> > Function gridColors
> > local lnReturn
> > do case
> > case catorder=[CX]
> > lnReturn= RGB(0,255,64)
> > case catorder=[IN]
> > lnReturn=RGB(0,255,255)
> > case catorder=[PP]
> > lnReturn=RGB(255,128,128)
> > otherwise
> > lnReturn=RGB(255,255,255)
> > endcase
> > Return lnReturn

> >
> > There's a fine line between helping and adding to the confusion.
> >
> > How to create sample data
>
> Thanks Bleken.. I changed it to a Function and it still don't work. I checked the RGBs and they work fine with IF statements
> so I don't see the color problem there at all. But again, the ICASE, which I also changed taking out Otherwise.. nor the CASE work for some reason.
> I haven't figured it out yet.. I don't know if VFP has a way to disable that, I don't think that is possible but I don't really
> know. I do have the form working with the IIFs from the first example so I am doing ok with that part.. but I am worried that I will
> need a CASE or ICASE situation and it might not work...
>
>
> It seems to acknowledge the very first case or icase, but nothing else happens..
> Just makes all my rows the same color as the first...to my knowledge CASE and ICASE should evaluate each CASE as it goes through.
>
>
> Dr. Quest

Restore your faith back to ICASE(). There is nothing wrong with it only that like the others said you don't need to use the word OTHERWISE there. The otherwise is the last comma:

Y = ICASE(x=1,'a',x=2,'b',x=3,'c','d')


Look closer, the last condition is case x=3 then y='c'. Then a simple comma representing OTHERWISE it is 'd'.

As for changing the procedure and function, vfp really doea not care anymore. Those are now interchangeable. Tore is just saying that by proper usage, a function is designed to return a value and proc do not (in root xbase languages). But in vfp, a proc can now also return value much like a function.

I am not sure if what you are saying is even with removing otherwise, the desired colors do not appear or it does. It is not clear to me plus it is hard to view a post using a mobile phone.

https://vfpx.codeplex.com/releases/view/99045
http://sandstorm36.blogspot.com

ENTIRE THREAD

my CASE or ICASE won't work VFP9 Posted by Johnny Quest @ 12/30/2014 8:12:21 PM
RE: my CASE or ICASE won't work VFP9 Posted by Tore Bleken @ 12/30/2014 8:26:50 PM
RE: my CASE or ICASE won't work VFP9 Posted by Johnny Quest @ 12/30/2014 9:02:34 PM
RE: my CASE or ICASE won't work VFP9 Posted by Tore Bleken @ 12/30/2014 9:19:10 PM
RE: my CASE or ICASE won't work VFP9 Posted by Mike Yearwood @ 12/30/2014 9:41:04 PM
RE: my CASE or ICASE won't work VFP9 Posted by Jun Tangunan @ 12/30/2014 10:03:04 PM
RE: my CASE or ICASE won't work VFP9 Posted by Gene Wirchenko @ 12/30/2014 8:34:16 PM
RE: my CASE or ICASE won't work VFP9 Posted by Johnny Quest @ 12/30/2014 9:05:43 PM
RE: my CASE or ICASE won't work VFP9 Posted by Tore Bleken @ 12/31/2014 10:53:16 AM
RE: my CASE or ICASE won't work VFP9 Posted by Chuanbing Chen @ 12/31/2014 12:11:31 PM