guiSpinnerCreate (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-400

Firmware version:

1.00.00


This function creates a new numeric spinner on the provided form.gui_spinner_narrow

Numeric spinners are used to allow the user to enter a numeric value, which triggers the spinner changed event.

If the width of the spinner is three or more times larger than the height, it will show two buttons for incrementing and decrementing the value.gui_spinner_wide

Clicking the button increments/decrements the value by 1, and long pressing increments/decrements the value by 100.

 

Input:

form : SYSHANDLE

A handle to the form that the spinner is created on.

 

x : SINT default 1

The horizontal location of the spinner.

 

y : SINT default 1

The vertical location of the spinner.

 

w : SINT default 1

The width of the spinner.

 

h : SINT default 1

The height of the spinner.

 

tag : DINT

The tag value to store.

 

value : DINT

The initial value of the spinner.

 

min_value : DINT default -2147483648

The minimum allowed value of the spinner.

 

max_value : DINT default 2147483647

The maximum allowed value of the spinner.

 

Output:

spinner : SYSHANDLE

The handle to the new spinner.

 

Returns: INT

0

- Success.

-1

- Interface is not open (see guiOpen).

-2

- Not enough memory / resources.

-3

- Invalid argument. min/max or value out of range.

-5

- Unknown error

-10

- Invalid location or dimension.

-11

- The GUI API is not supported.

-12

- The location is already used.

 

Declaration:

FUNCTION guiSpinnerCreate : INT;
VAR_INPUT
  form      : SYSHANDLE;
  x         : SINT := 1;
  y         : SINT := 1;
  w         : SINT := 1;
  h         : SINT := 1;
  tag       : DINT;
  value     : DINT;
  min_value : DINT := -2147483648;
  max_value : DINT := 2147483647;
  spinner   : ACCESS SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc     : INT;
  spinner : SYSHANDLE;
  form   : SYSHANDLE;
END_VAR;
 
BEGIN
  ...
  // Create a spinner for the range -10..10
  rc := guiSpinnerCreate(spinner := spinner, form:=form, x:=2, y:=3, w:=3, h:=1,
           tag:=43, min_value := -10, max_value := 10, value := 0);
  ...
END;
END_PROGRAM;