Contents Previous Next Subchapters

Displaying Program Status in a Dialog
Syntax include status.oms
CreateStatusDialog(captionnrncoption)
SetStatusDialog(valuedt)
DeleteStatusDialog
DeleteStatusDialog(option)
See Also errordlg

Description
These routines maintain a dialog that displays the current status of an executing program. They must first be loaded with the command
     include status.oms
before they can be used.

CreateStatusDialog(
captionnrncoption)
Creates a dialog (not modal) that can be used to display a character matrix. The character row vector caption specifies the caption for the dialog. The integer scalars nr and nc specifies the maximum number of rows and columns in the character matrix that will be displayed in the dialog. The character row vector option is be either "enable" or "disable". This enables and disables deletion of the dialog (see discussion of DeleteStatusDialog(option) below). If there already is a status dialog being displayed when the function CreateStatusDialog is called, it is replaced by the new one.

SetStatusDialog(
valuedt)
Changes the contents of the status dialog to be the character matrix value. This matrix cannot have more than nr rows or nc columns where nr and nc correspond to the previous call to the function CreateStatusDialog, If no status dialog is currently being displayed, a call to SetStatusDialog has no effect. If the time since the previous call to SetStatusDialog is less than the value dt, the dialog is not changed and the call to SetStatusDialog has no effect. The value dt can be an integer, real or double-precision scalar. This can be used to avoid the status dialog changing so rapidly that the user cannot read it.

DeleteStatusDialog(
option)
Changes the current setting for the deletion option in the status dialog to option where option is either "enable" or "disable". This enables and disables deletion of the window using the system caption bar the "Close" button within the dialog or a call to DeleteStatusDialog with not arguments present. Note that if the user chooses a button in a dialog while O-Matrix is running, a beep will sound automatically so option should probably be "disable" while the program is running.

DeleteStatusDialog
Deletes the status window if the current option setting is "enable", otherwise it generates a beep. If no status dialog is currently being displayed, this call has no effect.

Example
The following example displays a status dialog in which a for loop index is updated once per second.

clear
include status.oms
caption = "Program Status"
nr      = 5
nc      = 50
option  = "disable"
CreateStatusDialog(caption, nr, nc, option)
for index = 1 to 100000 begin
     line1 = "Use the red hand or wait for execution to stop"
     line2 =   [ ...
          "Enter the command: DeleteStatusDialog(", ...
          dquote("enable"), ...
          ")" ...
     ]
     line3 = "Select the Close button"
     line5 = [ ...
          "For loop index: ", ...
          ntoa(index) ...
     ]
     value = {line1, line2, line3, "", line5}
     dt    = 1
     SetStatusDialog(value, dt)
end