[futurebasic] Re: Break ... Until

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

From: Joe Kovac <locality@...>
Date: Sat, 27 Dec 1997 09:22:15 -0400
>So, If _I_ were to design a compiler for a Mac I'd make sure that the
>HANDLEEVENTS executes often and passes parameters to DO ... UNTIL and WHILE
>... WEND loops. What right do they have to exclude HANDLEEVENTS. None
>whatsoever.

Although this seems to make sense at first, (it did to me when I first used
QuickBASIC) what a compiler would essentially have to do to make this work
is embed an invisible HANDLEEVENTS on every single line. FB can be made to
do this through the use of EVENT ON/EVENT OFF, I believe. However, handling
events on every line can have some nasty effects:

1. It slows things way down. (I realize speed isn't important to everyone)
2. Imagine you have a menu command called Sort, that performs a lengthy
Sort. If HANDLEEVENTS worked on every line the user would be able to pick
Sort again while the function was still in the middle of executing. I
didn't spend much time with QB before tossing it, but preventing that was
always kind of ugly.

>Detect systemActivity
>If no systemActivity for 10 mins
>then start screenSaver
>until mouseClick
>
>I _was_ trying to do this as:
>
>Do
>   FN screenSaver
>Until mouseClick
>
>However as _I_ now know, this doesn't work. Pity.

This can be coded this way:

LOCAL FN ScreenSaver
  'Draws one frame of screen saver animation then returns.
END FN

DO
  FN ScreenSaver
UNTIL FN BUTTON

However, this means you'd have to keep track of all the screen saver's
variables in globals because the locals will be forgotten by the next time
you execute FN ScreenSaver. It would probably make more sense to code it
like this:

LOCAL FN ScreenSaver
  DO
    'Draws one frame of screen saver animation.
    'Keeps updating until mouse button clicked.
  UNTIL FN BUTTON
END FN


FN ScreenSaver

They do about the same thing. Not to be offensive, but I don't see the big
deal here.

Hope that helps,
Joe K.
locality@...