DialogAddNumericKeyPad Function

Help Contents

Introduction

Adds a read-only text field and a numeric key pad to the current dialog.

Syntax

Informal Syntax:

DialogAddNumericKeyPad( Target )

Formal Syntax:

DialogAddNumericKeyPad( Target:=Variable Reference )

Parameters

ParameterTypeDescription
Target REF_TO ANY_NUM 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.

Return Value

None.

Example

The following example shows how to use the DialogAddNumericKeyPad() function:

VAR 
	Value : LREAL;
	DialogResult : INT;
END_VAR

(* Get the current value of the tag *)
Value := %".Value Tag";

(* Start a new dialog definition *)
DialogNew();

(* Add a label showing the current target *)
DialogAddLabel(CONCAT('Current target: ', TO_STRING(Value)));

(* Add another label above the numeric keypad *)
DialogAddLabel('Enter new target:');

(* Add the Numeric Keypad *)
DialogAddNumericKeyPad( Value );

(* Open the dialog.  The program waits here until the user presses OK or Cancel *)
DialogResult := DialogOpen( "Set Target", 1 );

(* Did the user press OK ? *)
IF DialogResult = 1 THEN
	
	(* User pressed OK, so write the new value *)
	TagWriteValue( 
		%".Value Tag.FullName",
		Value );
END_IF

Notes:

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

Numeric key pad dialog.

Further Information

DialogNew()

To learn about starting a new dialog definition.

DialogAddLabel()

To learn about adding labels to a dialog definition.

DialogOpen()

To learn about opening the current dialog definition.

Operator Actions

To learn where you can use this function.

Glossary

For the meaning of terms used in Fernhill SCADA.