This function constructs an ENVIStartMessage object to send to the ENVIBroadcastChannel. If the ENVI user interface is running, then a progress dialog will appear.


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
  ; Start the application
  e = ENVI()
  ; Get the broadcast channel to send messages to the ENVI system
  Channel = e.GetBroadcastChannel()
  ; Create an object that uniquely identifies the message.
  ; Use the ENVIAbortable object to check if progress
  ; was cancelled.
  Abort = ENVIAbortable()
  ; Broadcast a start message to the ENVI system
  Start = ENVIStartMessage('Progress Bar Title', Abort)
  Channel.Broadcast, Start
  ; Determine the number of steps to calculate
  ; percent complete for progress
  nSteps = 73
  ; Initialize progress
  Progress = ENVIProgressMessage('Executing Progress Message', $
    0, Abort)
  ; Iterate through the work
  FOR stepIndex=0, nSteps DO BEGIN
    ; Calculate progress for the step
    percentProgress = Round(stepIndex* 100.0/nSteps)
    ; Update progress percentage and broadcast the progress
    ; message to the ENVI system
    Progress.Percent = percentProgress
    Channel.Broadcast, Progress
    ; Check if aborted after sending progress to see if
    ; Abort_Requested was set by any listeners
    IF (Abort.Abort_Requested) THEN BREAK
    ; Simulate an analytic
    dataProcess = dist(1000)
    ; Print the step to see the abort working
    PRINT, stepIndex
  ; Broadcast a finish message to the ENVI system
  Finish = ENVIFinishMessage(Abort)
  Channel.Broadcast, Finish


Result = ENVIStartMessage(Message, SourceObject)

Return Value

This function returns a reference to an ENVIStartMessage object.



Specify a string indicating the title of the progress dialog.


Specify an object to have the message uniquely identified. If you provide an object that implements the ENVIAbortable interface, then the progress dialog will have a Cancel button and you can query the ABORT_REQUESTED property on your object to determine if the user cancelled the progress dialog.


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

ENVI 5.3


API Version


See Also

ENVIBroadcastChannel, ENVIProgressMessage, ENVIFinishMessage, Messaging