DialogAddValue Function

Help Contents

Introduction

Adds a field to the current dialog, where the field is mapped to a program variable. The type of field added depends upon the type of variable:

Syntax

Informal Syntax:

DialogAddValue( Prompt, Target )

Formal Syntax:

DialogAddValue( Prompt:=Expression, Target:=Variable Reference )

Parameters

ParameterTypeDescription
Prompt ANY_STRING The prompt string associated with the text entry field.
Target REF_TO ANY_ELEMENTARY A reference to a program variable:
  • The field is initialized with the value of the program variable when the dialog is opened.
  • The value of the field is written to the program variable when the OK button is pressed.

When the Target field is a BOOL value, the function creates a check box to represent the field value. For all other types of field, the function creates a text entry field to represent the field value.

Return Value

None.

Examples

  1. Use DialogAddValue to add a check box field to a dialog:
    VAR NewState : BOOL; DialogResult : INT; END_VAR
    
    DialogNew();
    DialogAddValue( "New State", NewState );
    DialogResult := DialogOpen( "Set new state", 1 );
    IF DialogResult = 1 THEN
        (* Add code here to do something with NewState *)
    END_IF

    The above code sample would display this dialog:

    Dialog showing a check box field
  2. Use DialogAddValue to add a text entry field to a dialog:
    VAR NewValue : REAL; DialogResult : INT; END_VAR
    
    DialogNew();
    DialogAddValue( "New Value", NewValue );
    DialogResult := DialogOpen( "Set new value", 1 );
    IF DialogResult = 1 THEN
        (* Add code here to do something with NewValue *)
    END_IF

    The above code sample would display this dialog:

    Dialog showing a check box field

Further Information

Operator Actions

To learn where you can use this function.

Glossary

For the meaning of terms used in Fernhill SCADA.