update to the ErrHandler download
Keywords: ErrHandler, Enhancement
Remote Name: 22.214.171.124
The downloadable errhandl.zip file has been updated with a new version, which replaces the previous one dated 5/23/01.
Please note that the online ErrHandler documentation and and task list have not been updated, however.
Here is a brief summary of the changes in this latest version:
- fixed RETURN TO ... .F. problems for Aborts and unusual errors
made changes in several places (errherr, errhoerr, and errhshow.prg) to assure that Aborts and unusual failures return a .F. result.
(This required a workaround to a VFP bug that causes spurious syntax errors when attempting to return a literal .F. result via a RETURN TO ... statement.)
- fixed non-local returns to avoid problematic cases of ON ... statements
adjusted logic in errherr, errhoerr, and errhshow.prg to deal with VFP's inability to RETURN TO a stack level occupied by an ON ... statement, such as a menu action.
In those cases, the return is now made to a previous level of the stack, which should be equivalent, since
an ON ... statement executes only a single command.
- fixed an obscure bug in Abort propagation logic in errhcopy.prg
(see program comments)
Extensions and Other Enhancements
- introduced a new diagnostic command processor associated with each ErrHandler
(see further explanation below)
- improvements to the diagnostic message dialog
- revised the form to use Desktop = .T.
i.e. to make the dialog appear in the Windows desktop instead of the main VFP window.
This avoids being constrained by the size of the main VFP window, which may be too small to allow proper viewing of the complete message dialog.
- added a button for launching the new diagnostic command processor
(But take note of the caution below.)
You may need to click the CmdProc button twice in order to activate it,
because the message dialog uses Desktop = .T.
- included the window caption in editbox contents
so that one can easily copy the entire error message, including info in the dialog's title bar.
- added a right-click context menu for selecting and copying message
- new global error handler facility
The ErrHCustom class now supports the ehp_on_err_handle option, which
previously applied only to class ErrHForm. By setting this flag
to .T., you are telling ErrHCustom to establish a global ON ERROR handler,
i.e. to handle any errors that are not otherwise covered by various forms
and Error event methods.
- demo refinements
- added a demo menu
This was done primarily to test out the new global error handler
feature. I also threw in a few other commands, e.g. to illustrate
the Abort-stops-here mechanism. In order to use the demo menu, you
should launch the demo application in its modeless flavor of operation,
which is done via the following VFP command line:
- added a button to the demo form for launching the diagnostic command processor
(But again take note of the caution below.)
- introduced the new errhabor.prg core UDF
to reduce the amount of redundant logic in ehm_abort methods of all ErrHandler foundation classes.
- added a few new foundation ErrHandler classes
based on Editbox, CommandButton, Container, and the WebBrowser ActiveX
control. These classes are not actually used in the errhdemo program, but were created for use in other applications.
They are simply the counterparts of ErrHCustom and ErrHForm to cover some other VFP base classes, where I found it convenient to treat these controls as independent ErrHandler objects.
(Additional ErrHandler foundation classes may eventually be supplied for other VFP base classes, as needed.
Typical applications would only require ErrHForm and/or ErrHCustom, though.)
The New Diagnostic Command Processor
This is a developer-oriented feature that simplifies testing and debugging, especially in a pure runtime environment.
The resizable, modeless command processor executes an arbitrary VFP command line from the context of the associated
ErrHandler, and multiple command processors can co-exist (one for each
ErrHandler object). Thus, for example, the command:
displays the name of the associated ErrHandler object to the main screen
area. Other properties and methods can be similarly accessed. Note that THIS and THISFORM can be used in
these special command windows, which can be a major convenience. Support of this feature also entailed adding the new EHM_DoCmd method and a number of properties
to each of the ErrHandler foundation classes.
Caution: Be careful with this feature, because it can easily wreak havoc in your application, and it's strictly for advanced usage.
Be warned, also, that there is a trap you can easily get into where you can't exit from your application without killing it via Ctrl+Alt+Del.
This can occur when the command processor is launched from a modal dialog.
To avoid this trap, you must close the command processor window before activating another window, or you may get stuck in a condition where you can no longer resume the application or exit gracefully.
(I'm still looking for ways to avoid this problem and support this feature more cleanly.)
Brought to you by SpaceTime Systems.
All rights reserved.