In traditional procedural languages, like Pascal or BASIC, programs typically consist of a main routine that runs when the program starts. This routine may issue program calls to other routines. When the main routine has finished, so has the program. Any interaction between the program and the user is restricted. The user can interact with the program only when the program allows it.
Graphical applications like those written in Dexterity operate differently. Rather than having one main routine that runs when the program starts, code is spread out through the interface. The individual pieces of code run when the user interacts with the form, window or control where the code is located. The interaction between the program and the user is not restricted in any way. The user can interact with any element in the interface at any time.
This “interaction-based” approach to designing programs is new to many people learning to create applications with Dexterity. As the programmer, you need to ensure the program performs the desired tasks, and you also need to manage all of the possible interactions between the program and the user.
The next section contains a general procedure you can use when creating scripts for Dexterity-based applications. This procedure attempts to handle the “interaction” aspects of scripting, as well as the “functional” aspects.