Use this object class to communicate if an abort is requested. Custom classes can inherit this class if you want to extend the behavior. If you provide an object that implements the ENVIAbortable interface to ENVIStartMessage, then the ENVI user interface progress dialog will have a Cancel option and you can query the ABORT_REQUESTED property on your object to determine if the user cancelled the progress dialog.
Example
This example demonstrates how all of the ENVI API messaging components work together. It simulates an analytic operation and updates its progress in a progress bar and in the IDL console.
PRO ProgressBarAbortExample
COMPILE_OPT idl2
e = ENVI()
Channel = e.GetBroadcastChannel()
Abort = ENVIAbortable()
Start = ENVIStartMessage('Progress Bar Title', Abort)
Channel.Broadcast, Start
nSteps = 73
Progress = ENVIProgressMessage('Executing Progress Message', $
0, Abort)
FOR stepIndex=0, nSteps DO BEGIN
percentProgress = Round(stepIndex* 100.0/nSteps)
Progress.Percent = percentProgress
Channel.Broadcast, Progress
IF (Abort.Abort_Requested) THEN BREAK
dataProcess = dist(1000)
PRINT, stepIndex
ENDFOR
Finish = ENVIFinishMessage(Abort)
Channel.Broadcast, Finish
END
Syntax
Result = ENVIAbortable()
Methods
None
Properties
Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.
ABORT_REQUESTED (Get, Set)
When the ENVIAbortable class is created, the ABORT_REQUESTED property is set to 0. Set it to 1 to indicate that an abort was requested.
Keywords
ERROR (optional)
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See Manage Errors for more information on error handling in ENVI programming.
Version History
API Version
4.2
See Also
ENVIBroadcastChannel, ENVIStartMessage, ENVIProgressMessage, ENVIFinishMessage, Messaging