MGHWAITER__DEFINE Name
MGHwaiter Purpose
Maintains a widget which allows the user to abort or suspend execution.
Category
Utilities.
Procedure
To allow user intervention in a lengthy calculation, we create an
MGHwaiter object. This appears as a widget base with 3 buttons:
'Abort', 'Suspend' and 'Resume', the last being initially
insensitive. We then call the object's Yield method at regular
intervals throughout the calculation. The Yield method checks to
see if any of the buttons has been pressed. If the Abort button
has been pressed, then Yield calls the MESSAGE procedure to raise
an error. If the Suspend button has been pressed, then Yield goes
into an infinite loop calling WAIT until Resume is pressed.
###########################################################################
This software is provided subject to the following conditions:
1. NIWA makes no representations or warranties regarding the
accuracy of the software, the use to which the software may
be put or the results to be obtained from the use of the
software. Accordingly NIWA accepts no liability for any loss
or damage (whether direct of indirect) incurred by any person
through the use of or reliance on the software.
2. NIWA is to be acknowledged as the original author of the
software where the software is used or presented in any form.
###########################################################################
Modification History
Mark Hadfield, Apr 1994:
Written as procedure YIELD. This was originally intended for use
under co-operative multi-tasking versions of Windows; it called
the Windows API "Yield" function to yield control to other
processes.
Mark Hadfield, Oct 1995:
Removed calls to the Win API Yield function. Now all the YIELD
procedure does is to maintain a widget and check its state.
Mark Hadfield, Jun 1999:
This application was converted to an object called MGHwaiter.
Mark Hadfield, May 2000:
MGHwaiter is now a subclass of MGH_GUI_Base and uses the
superclass's facilities for event handling and appearance
copntrol. This means it no longer requires the obsolete XMENU
routine.