navFormAddOption (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 an option to a selection field on the form that is currently being constructed.

 

Input:

id : DINT (1..2147483647)

Unique ID to identify the option.

 

select_id : DINT (1..2147483647)

The ID of the selection field to add this option to.

 

title : STRING

The title of the option. Max. 40 characters.

 

selected : BOOL (default FALSE)

Set to true to make the option selected by default.

If the selection field uses single selection, marking multiple options as selected will cause an invalid parameter error.

 

 

Returns: INT

0

- Success.

-1

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

-3

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

-7

- Selection field could not be found.

-8

- Invalid parameter.

-10

- There is not space for more options in the selection field.

 

Declaration:

FUNCTION navFormAddOption : INT;
VAR_INPUT
  id         : DINT;
  select_id : DINT;
  title     : STRING;
  selected   : BOOL := FALSE;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM NavigationExample;
VAR
  rc : INT;
END_VAR;
BEGIN
  ...
  // Add a selection field with two options to the form.
  rc := navFormAddSelect(id := 3, title:="Options", desc:="Select options",multi:=TRUE);
  DebugFmt(message := "Add select=\1", v1 := rc);
 
  rc := navFormAddOption(id:=1, select_id:=3, title:="Option 1");
  DebugFmt(message := "Add option=\1", v1 := rc);
 
  rc := navFormAddOption(id:=2, select_id:=3, title:="Option 2");
  DebugFmt(message := "Add option=\1", v1 := rc);
  ...
END;
END_PROGRAM;