Debugging Widget Applications
In addition to the “normal” debugging tasks associated with any IDL program, widget applications also require you to debug errors in the widget event loop. If your widget application experiences errors in an event handling routine, keep the following points in mind:
- By default, XMANAGER catches errors and continues processing (see CATCH). If you are using XMANAGER to manage your widget application (as in most cases you should), calling XMANAGER with CATCH=0 will cause XMANAGER to halt when it encounters an error.
- Setting CATCH=0 is useful during debugging, but finished programs should run with the default setting (CATCH=1) and refrain from setting it explicitly.
- CATCH is only effective if XMANAGER is blocking to dispatch errors. During debugging, make sure to call XMANAGER with NO_BLOCK=0 (the default).
Setting NO_BLOCK=0 is useful during debugging, but in many cases you will want your finished program to set NO_BLOCK=1 in order to allow other widget programs (and the IDL command line) to remain active while your application is running.
If a widget application stops responding, you can restart event processing by doing the following:
- Enter RETALL at the IDL prompt to return to the main program level.
- Optionally, modify the code to fix the error and re-compile.
- If one or more of the applications you are running blocks the active command line, enter XMANAGER at the IDL prompt in order to have it resume processing events in the blocking mode. If all applications have NO_BLOCK=1 set, a call to XMANAGER will immediately return, and can be safely omitted.