Home
Ceylon logo

Concepts

This site supports Convergence

 

What's new?

Our mission

Who are Topix?


Acorn freeware

The beta area

Articles

CodeCraft

 

What was the situation in the past? And what's it now?

Writing multitasking applications running in the WIMP environment involves some special techniques compared to singletasking programs running from the commandline or running full screen. Previously the program was in full control; the programmer determined in which order the user was able to do things, for example fill in a screen. Nowadays it's complete the other way around. The user is able to work in different sections of the program at the same time. Hence control about the program flow is in the users hands.

How is this managed?

The program flow is completely controlled by events. An event may be an action by the user, e.g. the user clicks in a window or makes a choice from a menu. It can also be a message from the system ("going down now!") or a message from another program ("I've got a file for you, could you try to load it?"). Because usually more than one program is running at the same time, the order in which events happen isn't fixed.

So what are the consequences?

Because the program flow is controlled by events, actions from outside the program, the application must be based on a so called event loop. This is a loop which basically looks like this:
while (program has not been ended)
{
   wait for an event to happen
   take some action
}
That doesn't look to hard, eh? Ofcourse things are slightly more difficult than this. In the next chapters we will build a fully functional program step-by-step. Just keep this simple rule in mind: the user should be in control of the application, not the programmer.

Last update: 21 Mar 1998