Sliders & Images

H Baric hbaric at gmail.com
Wed Aug 6 08:27:48 EDT 2008


Wow cool, thanks Kay!

Let me tell you, from where I've been the last couple of years, to where I 
am now, being able to use my brain like this, when I didn't think I ever 
would again, receiving such kind encouragement from you guys is meaning an 
AWFUL lot :)

Hehemm excuse my soppiness!

And I'm just so excited to finally find a way of making one of my "great 
ideas that I've had for ages" a reality, and in way less time than I ever 
thought possible!

Rev, along with such an amazing community and resources is making it so 
easy, and sooo enjoyable :)

It's truly a Revolution for ME. I HATED school. But I LOVE learning and 
being creative. Rev Rox!

Right well, back to study before I ramble too much more (at this time of 
night my messages get way too long and deep hehe).

:)

Cheers,
Heather


----- Original Message ----- 
From: "Kay C Lan" <lan.kc.macmail at gmail.com>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: Wednesday, August 06, 2008 9:40 PM
Subject: Re: Sliders & Images


On Wed, Aug 6, 2008 at 5:27 PM, H Baric <hbaric at gmail.com> wrote:

>
> Now Randy, your script here makes perfect sense to me as a beginner! 
> Eric's
> not so, but I want it to, so these two scripts I shall take away and learn
> from!
>

You are doing extremely well to already have your head around switch
statements. There are long timers on this List who still shy away from them.

Whilst I would not deter you from learning from Eric's excellent example,
let me offer one really nice feature you can take advantage of with the
Switch statement; and that is the 'default' option.

switch myColour
  case "red"
    redHandler
  break
  case "green"
   greenHandler
  break
  case "blue"
    blueHandler
  break
  --handy feature during development
  default
    answer "I haven't covered the " & myColour & " situation." titled
"Switch Error"
    breakpoint
end switch

In this case if you have an option menu, or a dialog box, or whatever, with
the three colour options and you decided to include all the colours of the
rainbow, if you forget to change your switch statement, you will
automatically be told, best of all if you have script debug mode turned on,
once you press OK to the answer dialog box that popped up to tell you about
the Switch error, the debugger will pop up and stop in the very Switch
statement that is missing the extra options! So easy to then fix :-)

Whilst I can normally remember to get the Switch statements sitting right
there in an option menu, I've really come to like Switch statements and my
scripts are now infested with them so I often forget some of the
ramifications of adding additional options. Default picks it up EVERY time.

My stacks are for me, so it doesn't matter if I leave these statements as
is, especially since I'll probably add a new option 2 months down the track
and completely forget again the ramifications that can have. On the other
hand, when you've gone final, it's easy enough to do a global search for
'default' and remove what would be useless lines of code in a perfect
product ;-)

Keep up the Revolution.
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution 




More information about the use-livecode mailing list