[futurebasic] Re: Break ... Until

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: tatewake@... (Terence Jordan)
Date: Sat, 27 Dec 1997 02:59:40 -0400
--
It's not that they "don't work" in a do/until or while/wend loop. Read on...

>LOCAL FN beeper3                'cmd . works
>  SELECT x
>    CASE 0
>      BEEP
>  END SELECT
>END FN
>
>LOCAL FN beeper2                'cmd . works
>  IF x=0 THEN BEEP
>END FN

Yeah, sure these work.

>LOCAL FN beeper1                'cmd . doesn't work
>  WHILE x=0
>    BEEP
>  WEND
>END FN
>
>LOCAL FN beeper                 'cmd . doesn't work
>  DO
>    BEEP
>  UNTIL x=1
>END FN

Because you never call a handleevents within the FN beeper routine! Calling
an FN doesn't start another thread! This is the logic you're using; you're
expecting it to do start a new FN beeper thread whilest doing another
handleevents event and catching the command-period. It won't work that
way...! In you original example, you were stuck at FN beeper; you only
called it once, and it never exits; you never get past this and an event
never gets handled because handleevents was not called afterward!

Perhaps if you stuck a HANDLEEVENTS in your beeper loop, it would do what
you want, but that's not a suggestion I would go with.

Take the DO/UNTIL loop out of that beeper function and it works just fine!
Virtually the same code, too, and Cmd-.(or baby-puppy-foot-.) works just
fine.

What are you _really_ trying to accomplish with this? You mentioned this
was just a proto-type'd function of a bigger project? What's the ultimate
plan?



-- Terence Jordan (tatewake@...)
Inspired Software. http://inspired.netstreet.net/
Macintosh, Dos, Windows, and BeOS software solutions.
Phone: 407-728-7563
............................................
. New: Renegade Space Ninja for Macintosh! .
.      Visit our page for more info.       .
............................................