ConfirmActionDialog Function

Introduction

Opens a dialog with a title, message and OK and Cancel buttons.

Informal Syntax:

ConfirmActionDialog( Title, Message )

Formal Syntax:

ConfirmActionDialog( Title:=Expression, Message:=Expression )

Parameters

ParameterTypeDescription
Title ANY_STRING The title that appears at the top of the dialog.
Message ANY_STRING The message to display in the dialog.

The ConfirmActionDialog() function is logically equivalent to:

FUNCTION ConfirmActionDialog : INT
VAR_INPUT
    Title : WSTRING;
    Message : WSTRING;
END_VAR

    DialogNew();
    DialogAddLabel( Message );
    ConfirmActionDialog := DialogOpen( Title, 1 );
END_FUNCTION

Return value

An INT value indicating which button was pressed:

ValueButton
0Cancel
1OK

Example

In the following example, the operator action code displays the Confirm Action Dialog. If the user presses the Cancel button, the Result value will be 0 and the code skips the remaining statements. If the user presses the OK button, the Result value will be 1 and the code goes on to execute the additional statements:

VAR Result : INT; END_VAR

Result := ConfirmActionDialog(
        "Confirm Shutdown", 
        "Please confirm you want to halt the current process?");

IF Result = 1  THEN
    (* Statements executed in the user presses the OK button *)
END_IF

The following image shows the dialog displayed by the preceding code example:

Confirm Action Dialog

Further Information

DialogNew

To learn about the DialogNew() function.

DialogAddLabel

To learn about the DialogAddLabel() function.

DialogOpen

To learn about the DialogOpen() function.

Operator Actions

To learn where you can use this function.

Glossary

For the meaning of terms used in Fernhill SCADA.