Displays a pop-up dialog box on the web interface Operator Control Panel (basic modes).
Controller.ShowDialog( button_labels, message, button_index)
-or-
Controller.ShowDialog( button_labels, message, button_index, text_field )
Prerequisites
None
Parameters
button_labels
A required String expression containing the button labels to be displayed. Up to 4 buttons can be specified, separated by commas. If the button labels contain blanks or commas, they should be enclosed in quotes. The string must not contain the vertical bar "|" character.
message
A required String expression containing the message to be displayed in the dialog box. The string must not contain the vertical bar "|" character.
button_index
A required ByRef Integer variable that receives the index of the button pressed in the dialog box. 1 for the first button, 2 for the second, etc.
text_field
(2nd formof this method) An optional ByRef String variable that receives the value of any text entered into the dialog box text field. Its initial value is shown as the default value of the text field. The string must not contain the vertical bar "|" character.
Remarks
This method provides a simple way for a GPL procedure to communicate with the operator without creating a custom web page. When ShowDialog is called, its operation is as follows:
- Waits if another thread is already displaying a dialog box.
- Posts the dialog box for display and waits for the user to open the Operator Control Panel on the web interface and press a button.
- Un-displays the dialog box.
- Returns the button index and optional text field to the user.
Since this method generates a dialog box within a browser, any special text formatting must be defined as standard HTML specifications. In particular, to add a carriage return and line feed, include "<BR>" within the text. To have a section of text left justified, precede it with "<p align=left>" and terminate it with "</p>". The total number of characters available for defining the dialog box including all formatting is approximately 998 bytes.
This method is overloaded to support several dialog box styles. See "ShowDialog - Advanced " for other forms of this method.
In the simplest (1st) form, the pop-up displays only the message text and labeled buttons. When the user clicks on one of the buttons, the index of the button clicked is returned in the button_index variable.
In the text_field (2nd) form, the pop-up also displays a single text field that can be overwritten by the user. When the user clicks on one of the buttons, the current value of the text field is returned in the text_field variable, and the index of the button clicked is returned in the button_index variable.
If the thread displaying the dialog box is paused or stopped, the dialog box is un-displayed immediately.
Examples
Dim bi As Integer
Controller.ShowDialog("Okay", "Ready to begin process", bi)
Public Sub Test1
Dim bi As Integer
Dim reply As String
reply = "Part_1" ' Default is Part_1
Controller.ShowDialog("Okay, Cancel", _
"Enter part name", bi, reply)
If bi = 1 Then
… ' Okay selected
Else
… ' Cancel selected
End If
Console.WriteLine("You entered: " & reply)
End Sub
See Also
Controller Class | Controller.ShowDialog - Advanced| Controller.ShowDialogMCP | Controller.SystemMessage