Opens a dialog with a title, a text editor and, OK and Cancel buttons.
Informal Syntax:
TextEditorDialog( Title, Prompt, Rows, Columns, StringValue )
Formal Syntax:
TextEditorDialog( Title:=Expression, Prompt:=Expression, Rows:=Expression, Columns:=Expression, StringValue:=Variable Reference )
Parameter | Type | Description |
---|---|---|
Title | ANY_STRING | The title that appears at the top of the dialog. |
Prompt | ANY_STRING | The prompt string associated with the text entry field. |
Rows | ANY_INT | The number of rows to display in the text entry field. If the value provided is less than 1, the value is rounded up to 1. If the value provided is greater than 12, the value is rounded down to 12. |
Columns | ANY_INT | The approximate number of columns to display in the text entry field. If the value provided is less than 32, the value is rounded up to 32. If the value provided is greater than 240, the value is rounded down to 240. |
Target | REF_TO ANY_STRING |
A reference to a string program variable:
|
The TextEditorDialog() function is logically equivalent to:
FUNCTION TextEditorDialog : INT VAR_INPUT Title : WSTRING; Prompt : WSTRING; Rows, Columns : INT; END_VAR VAR_IN_OUT TextValue : WSTRING; END_VAR DialogNew(); DialogAddTextEditor( Prompt, Rows, Columns, TextValue ); TextEditorDialog := DialogOpen( Title, 1 ); END_FUNCTION
An INT value indicating which button was pressed:
Value | Button |
---|---|
0 | Cancel |
1 | OK |
In the following example shows how to use the TextEditorDialog() function:
VAR Result : INT; TankContents : WSTRING; END_VAR TankContents := %"Message Tag"; Result := TextEditorDialog( "Tank Contents", "Enter the description of the tank contents:", 3, 80, TankContents ); IF Result = 1 THEN (* Update the tank contents tag *) TagWriteValue( "Message Tag", TankContents ); END_IF
Code Notes:
The following image shows the dialog displayed by the preceding code example:
To learn about the DialogNew() function.
To learn about the DialogAddTextEditor() function.
To learn about the DialogOpen() function.
To learn where you can use this function.
For the meaning of terms used in Fernhill SCADA.