Controller.ShowDialog Method - Advanced Mode

Displays a pop-up dialog box on the web interface Operator Control Panel (Advanced Mode).

Controller.ShowDialog( mode, button_labels, message, button_index, field_labels, field_values )

Prerequisites

None

Parameters

mode

A required numeric expression that specifies the display mode.

If mode = 1, displays a vertical list of data fields that can be filled in by the user.
If mode = 2, displays a vertical list of up to 12 labeled buttons.

button_labels

A required String expression. The string must not contain the vertical bar "|" character.

If mode = 1, defines the button labels that are displayed along the bottom of the dialog box. Up to 4 buttons can be specified, separated by commas. If the button labels contain blanks or commas, the labels should be enclosed in quotes.
If mode = 2, this string is ignored and can be set to "".

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. Set to 1 for the first button, 2 for the second, etc.

field_labels

A required 1-dimensional String array. Each String array element contains a separate label. Up to 12 elements are permitted. The strings must not contain the vertical bar "|" .

If mode = 1, the array elements define labels that are displayed preceding each data field in the dialog box. The number of elements in this array determines the number of displayed fields.
If mode = 2, the array elements define labels for the vertical list of buttons. The number of elements in this array determines the number of displayed buttons.

field_values

A required 1-dimensional String array.

If mode = 1, this array receives the values of any text entered into the dialog box text fields. The initial values of this array are displayed as the default values of the text fields. The Strings must not contain the vertical bar "|" character.
If mode = 2, this array is ignored and may be empty.

Remarks

This method provides a 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:

  1. Waits if another thread is already displaying a dialog box.
  2. Posts the dialog box for display and waits for the user to open the Operator Control Panel on the web interface and click on a button.
  3. Un-displays the dialog box.
  4. Returns the button index and optional text field information 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 - Basic" for other forms of this method.

In this form, the dialog box allows different displays based on the mode parameter value.

If mode = 1, multiple fields may be entered and multiple values are returned. When the user clicks on one of the buttons, the values of all the fields are returned in the field_values array, and the index of the button clicked is returned in the button_index variable.

If mode = 2, a vertical array of buttons is displayed, with the field_labels text values displayed next to each button. The index of the button clicked is returned in the button_index variable. The field_values parameter is not used.

If the thread displaying the dialog box is paused or stopped, the dialog box is un-displayed immediately.

Examples

Public Sub Test2
Dim Buttons As String = "Okay, Cancel"
Dim Text As String = "Enter the field values"
Dim Label(2) As String
Dim
Field(2) As String
Dim
Index As Integer

Label(0) = "X value"
Label(1) = "Y value"
Label(2) = "Z value"

Field(0) = "100.0"
Field(1) = "100.0"
Field(2) = "0.0"

Controller.ShowDialog(1, Buttons, Text, Index, Label, Field)

Console.WriteLine("Button: " & CStr(Index))
Console.WriteLine("Field 0: " & Field(0))
Console.WriteLine("Field 1: " & Field(1))
Console.WriteLine("Field 2: " & Field(2))
End Sub



Public Sub Test3
Dim Text As String = "Select operation to perform."
Dim Label(2) As String
Dim
Nop() As String
Dim Index As Integer

Label(0) = "Start"
Label(1) = "Stop"
Label(2) = "Exit"

Controller.ShowDialog(2, "", Text, Index, Label, Nop)

Console.WriteLine("Button: " & CStr(Index))
End Sub


See Also

Controller Class | Controller.ShowDialog - Basic | Controller.ShowDialogMCP | Controller.SystemMessage