[futurebasic] Re: event loops

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1998 : Group Archive : Group : All Groups

From: Mars Saxman <marssaxman@...>
Date: Wed, 28 Jan 98 16:51:03 -0800
>The 1995 FB2 handbook enjoins us (page 55) not to use more than one event
>loop in a program. Why? So far as program logic is concerned there should
>be no trouble as long as the loops do not interfere and the FN doDialog s
>are redefined in appropriate places.
>
>It would be useful to have several event loops in one program, for example
>when combining several different programs, each with its own event loop
>into one.

The problem with multiple event loops is that it tends to encourage 
modality in applications. Events work _this_ way when the program is in 
this loop, _that_ way when the program is in the other loop. This is 
un-Mac-like and confuses the user.

While there is no technical problem with calling HandleEvents (or the 
Toolbox equivalent WaitNextEvent) in hundreds of places all over your 
program, it takes a lot of work to keep your program synchronized so that 
events work the same way no matter which event loop they are running in.

It is a practice like using lots of global variables: the language allows 
it, and there's nothing technically wrong with it, but it's not the most 
effective way to program.

-Mars