guiShowNumberInput (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-400

Firmware version:

1.00.00


This function shows a dialog that shows a keypad for the user to enter a number.

The dialog closes either when the user selects OK or Cancel, or when it times out.

gui_dialog_number

Input:

message : STRING

The message to show to the user

 

timeout : INT (-1, 0..3600) default -1

The number of seconds without activity before the dialog closes by itself. Use -1 for no timeout.

 

min_val : DINT default -2147483648

The minimum allowed value.

 

max_val : DINT default 2147483647

The maximum allowed value.

 

value : DINT

The initial value of the number.

 

Output:

value : DINT

The new value of the number.

 

 

Returns: INT

2

- Cancel

1

- OK

0

- Timeout

-1

- Interface is not open (see guiOpen).

-3

- Invalid timeout or min_val/max_val or value out of range..

-8

- The text contains invalid characters.

-9

- A dialog is already being shown.

-11

- The GUI API is not supported.

 

Declaration:

FUNCTION guiShowNumberInput : INT;
VAR_INPUT
  message : STRING;
  timeout : INT := -1;
  min_val : DINT := -2147483648;
  max_val : DINT := 2147483647;
  value   : ACCESS DINT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc      : INT;
  value   : DINT;
END_VAR;
 
BEGIN
  ...
  // Ask the user for a number between 1 and 10
  value := 1;
  rc := guiShowNumberInput(message := "Enter a number between 1 and 10!", timeout:=30,
    value := value, min_val := 1, max_val := 10);
  IF rc = 1 THEN
    DebugFmt(message:="Number \4 was selected", v4:=value);
  END_IF;
  ...
END;
END_PROGRAM;