ban2/png

tutor/gif
Home

cell/gif

Automatically ceasing program execution

A useful feature of AppBasic applications is that they automatically cease execution when a Quit_Quit event (&82A91) occurs. This event can be attributed in the design of resfiles so applications can be made to stop without the need for any code being written.

cell/gif
1/gif Make a copy of !MinApp, deleting its !RunImage file
minapp/gifMinApp can be found the Examples directory which is opened by Adjust-selecting AppBasic's iconbar icon.
2/gif Add an AppBasic !RunImage directory
The !RunImage directory should contain a !Run file (of type Obey) containing the command

Run AppBasic:Manager

At this stage !MinApp will run, placing its icon on the iconbar. However the application cannot be quit from the Quit iconbar menu-entry only via the task manager's display.
3/gif Edit the resfile so that selecting the “Quit” menu-entry generates the Quit_Quit event
1) Open MinApp's resfile display
resf/gifResfile displays are opened by double clicking the file (or dragging the file onto ResEd's iconbar icon)
2)View the menu template for IbarMenu
menu/gifMenu templates are viewed by double-clicking their icon in the resfile display
3)Double-click the Quit entry to open its menu-entry dialogue box.
dbox/gif In the Click action section of the dbox, select the Deliver event radio button labelled Other and type &82A91 into the writable icon. (When this menu entry is selected the Quit_Quit event will be generated).
An easy way to enter event codes into writable icons
edit/gif The Quit_Quit event can be inserted into writeable icons by placing the caret in the icon and selecting the green pencil-icon in its entry-page in AppBasic's StrongHelp manual.
4/gif Save the resfile - the application will now work exactly as the original and can be compressed to a single !RunImage file.

Notes: !MinApp's original C !RunImage file is 4,383 bytes long. The compressed !RunImage file produced by the above method is c. 550 bytes and will run in a wimpslot of 8K.
5/gif Worked solution