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
REF_TO DATE
A reference to a program variable:
  • The value of the field is written to the program variable when the OK button is pressed.

Return Value

None.

Examples

  1. Open a dialog that contains a numeric keypad:
    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 above code would show the following dialog:

    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.