guiRadioButtonCreate (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-400

Firmware version:

1.00.00


This function creates a new radio button on the provided form.gui_radio_button

Radio buttons are used to select between multiple choices, where only one choice can be active at a time. Selecting a radio button triggers the radio button selected event.

Multiple groups of radio buttons can be created, where only one radio button can be enabled at a time in each group.

 

Input:

form : SYSHANDLE

A handle to the form that the radio button is created on.

 

x : SINT default 1

The horizontal location of the radio button.

 

y : SINT default 1

The vertical location of the radio button.

 

w : SINT default 1

The width of the radio button.

 

h : SINT default 1

The height of the radio button.

 

tag : DINT

The tag value to store.

 

group : SINT

A value that must be the same for all radio buttons in the same group.

 

selected : BOOL default false

If the radio button should start selected. If this is used on multiple radio buttons in the same group, the radio button that is initialized last will be selected.

 

Output:

radio_button : SYSHANDLE

The handle to the new radio button.

 

Returns: INT

0

- Success.

-1

- Interface is not open (see guiOpen).

-2

- Not enough memory / resources.

-3

- Invalid argument.

-5

- Unknown error

-10

- Invalid location or dimension.

-11

- The GUI API is not supported.

-12

- The location is already used.

 

Declaration:

FUNCTION guiRadioButtonCreate : INT;
VAR_INPUT
  form         : SYSHANDLE;
  x            : SINT := 1;
  y            : SINT := 1;
  w            : SINT := 1;
  h            : SINT := 1;
  tag          : DINT;
  group        : SINT := 0;
  selected     : BOOL := FALSE;
  radio_button : ACCESS SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc          : INT;
  radiobutton : SYSHANDLE;
  form        : SYSHANDLE;
END_VAR;
 
BEGIN
  ...
  // Create a radio button
  rc := guiRadioButtonCreate(radio_button := radiobutton, form:=form, x:=2, y:=3, w:=1, h:=1, group := 0, tag:=43);
  ...
END;
END_PROGRAM;