Topic: APLX Help : Standalone APL Applications : The ⎕WI Sub-System in a Standalone Application
[Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

Using System Classes in a Standalone Application


User-defined windows and dialogs

APL applications which you write will typically use System Classes to create and manipulate windows, dialogs, and graphics. These will work in the standalone application in the same way as they do in the normal APL development environment, except that you should be careful not to rely on the APLX font being installed on the target system unless you specifically ensure that it is installed with your application.

MacOS About, Quit and Preferences menu items

Under Mac OS X, the 'About, 'Preferences' and 'Quit' menu items reside in the Application menu. (They are created automatically by the operating system). Because these menu items are not created under the control of your APL code, you cannot associate an APL callback function with them in the same way as you would for your own menus. APLX therefore provides three callbacks in the System object, which are triggered if any of these menu items are selected. They are onAboutMenu, onPreferencesMenu, and onQuitMenu. You should use these callbacks to provide the appropriate functionality in your application, so that your program will respond correctly if the user selects one of these menu items.

Under Windows or Linux, these callbacks can be defined, but will never be invoked.

Determining start-up parameters and responding to Apple Events

If you have packaged your APL workspace as a standalone application, it may be launched by the user dragging one or more documents on to the application icon or double-clicking a document (for this to work, you need to have set up the association between the file type/extension and the application). Under Windows or Linux, the user may also have started the application from the command-line. In either case, the System object's file property allows your APL program to respond correctly to these user actions. It is a read-only property, which you should retrieve at the beginning of your APL application code.

Under MacOS, file contains the full names of the document or documents which you should open or print. If there are several file names, they will be delimited by carriage-return characters. The action property indicates whether your should open or print them. As well as checking these properties when your application starts, you should also respond to any onOpen event for the System object. This will be triggered if, once the application is running, the user drags further file icons of the right type on to the application icon (or double-clicks on a file icon). This event corresponds to the 'Open Document' and 'Print Document' Apple Events; the file and action properties will be updated to indicate the new files which need to be opened or printed..

Under Windows, there are two possibilities. If the user dragged a document icon on to your application icon (or double-clicked the document icon), file will contain the full filename of the document. If the user started your application from the command-line, file will contain the command-line options which were entered.


Topic: APLX Help : Standalone APL Applications : The ⎕WI Sub-System in a Standalone Application
[Previous | Next | Contents | Index | APL Home ]