DialogAddComboBox Function

Help Contents

Introduction

Adds a Combo Box to the current dialog, where the field is mapped to a program variable.

Syntax

Informal Syntax:

DialogAddComboBox( Prompt, Options, Target )

Formal Syntax:

DialogAddComboBox( Prompt:=Expression, Options:=Expression, Target:=Variable Reference )

Parameters

ParameterTypeDescription
Prompt ANY_STRING The prompt string associated with the text entry field.
Options DINT The identifier of a LinkedList Data Object to provide the options in the combo box.
Target REF_TO ANY_ELEMENTARY A reference to a program variable:
  • The Combo Box is initialized with the value of the program variable when the dialog is opened.
  • The contents of the Combo Box is written to the program variable when the dialog is closed.

Return Value

None.

Remarks

How the Combo Box is initialized depends on the type of variable referenced by the Target parameter:

The value written to the Target parameter when the OK button is pressed depends on the type of variable:

Examples

  1. Use DialogAddComboBox to add a combo box field with two options to a dialog:
    VAR ListId : DINT; NewState : INT; DialogResult : INT; END_VAR
    
    (* Create a linked list storing the options *)
    ListId := LinkedListCreate();
    LinkedListAddLast( ListId, 'Close' );
    LinkedListAddLast( ListId, 'Open' );
    
    DialogNew();
    DialogAddComboBox( "New State", ListId, NewState );
    DialogResult := DialogOpen( "Set new state", 1 );
    IF DialogResult = 1 THEN
        (* Add code here to do something with NewState *)
    END_IF

Further Information

Operator Actions

To learn where you can use this function.

Glossary

For the meaning of terms used in Fernhill SCADA.