| Search Locate Previous Next | Contents |
The final stage in preparing an application for distribution is to set it to run automatically, start the main form, and sign out when the form closes. In Dyalog APL this is particularly easy, as you can find out whether you are in a runtime system with a simple query on root:
'.' WG 'APLVersion'
Windows 95/Windows NT 8.1.3 W Development
This means that you only need to maintain one copy of the workspace it can simply switch to runtime behaviour in a runtime interpreter. Here is the utility I conventionally set as my LX:
__msg{__msg}Run __lx
[1] © Check if we are in runtime mode, and run lx
under full trapping if so
[2] © If in a devt system - just report it.
[3] © Note that lx should end with OFF
[4] © For example lx'Go ª OFF'
[5] © LX'''Go © to test'' Run lx'
[6]
[7]
('Development'²'.'WG'APLVersion')__Skip
[8] __msg'The End' ª #.CPro.debug¯1 ª __lx ª
0
[9]
[10] __Skip:
(2=NC'__msg')0
[11]
[12] __msg'LX is: ',__lx
... and all you need for Go is a single line to CPro.Call dbx.main.
Error Trapping
When you are developing with Causeway, it is convenient to have some basic error trapping set on the refresh expressions for the various controls, and also on the actions run from events. The default situation is CPro.debug0 which simply reports all errors to the session. If you set partial debugging with CPro.debug1 this turns off the error traps and you get suspended at the point of error as normal.
For runtime use, you can set CPro.debug¯1 which routes all errors in dialogue-box expressions through #.CPro.ShowError, which provides a simple default handler. You can modify the error text, or simply run with debugging off and set your own (outer) trap in the LX. It is good practice to run with an outer trap anyway, as internal errors in Causeway class code are not caught by the above trap.
An easy and effective strategy is to SAVE the workspace with an easy-to-recognise name which will allow a reload at the point of the error with all Gui objects intact.