navFormAddNumber (Function)

Top  Previous  Next

Architecture:

NX32 / NX32L

Device support:

MX2 turbo/encore/warp, AX9 turbo, NX-200, NX-400, NX-900, LX2, LX4, LX5

Firmware version:

4.70 / 1.30.00

Nav. API level:

12


This function will add a number field to the form that is currently being constructed.

 

This field can be read from a received form by using navFormReceiveReadNumber.

 

 

Input:

id : DINT (1..2147483647)

Unique ID to identify the field.

 

title : STRING

The title of the field. Max. 50 characters.

 

desc : STRING

The description of the field to show below the title while no value has been entered. Max. 60 characters.

 

required : BOOL (default FALSE)

Set to true to make the field required.

 

max_length : INT (1..10, default 10)

Maximum length of the number that can be entered in the number field.

 

placeholder : STRING

The placeholder/help text to show in the field until a value is entered. Max 30 characters.

 

min_val : DINT (default -2147483648)

Minimum value that can be entered in the number field.

 

max_val : DINT (default 2147483647)

Maximum value that can be entered in the number field.

 

 

Returns: INT

0

- Success.

-1

- The form could not be found. Call navFormCreate first.

-3

- There is not space for more fields on the form.

-8

- Invalid parameter.

 

Declaration:

FUNCTION navFormAddNumber : INT;
VAR_INPUT
  id         : DINT;
  title     : STRING;
  desc       : STRING;
  required   : BOOL := FALSE;
  max_length : INT := 10;
  placeholder: STRING;
  min_val   : DINT := -2147483648;
  max_val   : DINT := 2147483647;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM NavigationExample;
VAR
  rc : INT;
END_VAR;
BEGIN
  ...
  // Add number field to the form
  rc := navFormAddNumber(id:=2, title:="Age", desc:="Your age", placeholder:="<years>",
                      min_val:=0, max_val := 120, max_length := 3);
  DebugFmt(message := "Add number=\1", v1 := rc);
  ...
END;
END_PROGRAM;