Note that there is no semi-colon after this final set of brackets. if one is included a syntax error will be generated when the program is run. Beware of making this very easy mistake!
Whenever a button is selected by the user, the AMOS Professional Interface performs the following sequence of actions:
Here are some examples of button definitions:
X> BU 1,80,38,50,10,0,0,1; set position and size of button number one [PR 1,2,'Button 1',6;][] draw button using a simple print command BU 2,10,38,50,10,0,0,1;[PR 1,2,'Button 2',7;][]
ButtonQuit
Interface instruction: trigger an exit button
BQ;
There are special buttons featured in the Editor requesters, such as [Ok] and [Cancel], which are used to leave the dialogue box the moment that they are selected by the user. These "Exit" buttons are created using the Button Quit instruction. This command can be placed inside the "change" brackets in order to trigger a forced exit from the dialogue box after the button has been selected. For example:
X> BU 1,80,38,50,10,0,0,1 ;[PR 1,2,'Button 1',6;][BQ;]
Drawing a button
Buttons can be drawn in a variety of styles, using any of the Interface graphics commands. A full
list of all these commands is fully explained in Chapter 9.2. Here are some typical options:
Text buttons can be created by enclosing the required text with a box or a filled bar, as follows:
X> BUtton 1,20,16,50,10,0,0,1; [INk 4,0,0;GraphicSquare 0,0,50,10; PRint 1,2,'Button',6;][] X> BUtton 2,120,16,40,1,0,0,1; [INk 1,0,0; GraphicBox 0,0,33,10; PRint 1,2,'Quit',4;][ButtonQuit;]