guiButtonCreate (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-400

Firmware version:

1.00.00


This function creates a new button on the provided form.gui_button

Buttons triggers button click events, when clicked by the user.

To change the text after it has been created, use guiControlSetText.

 

Input:

form : SYSHANDLE

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

 

x : SINT default 1

The horizontal location of the button.

 

y : SINT default 1

The vertical location of the button.

 

w : SINT default 1

The width of the button.

 

h : SINT default 1

The height of the button.

 

text : STRING

The text for the button to show.

 

tag : DINT

The tag value to store.

 

 

Output:

button : SYSHANDLE

The handle to the new button.

 

Returns: INT

0

- Success.

-1

- Interface is not open (see guiOpen).

-2

- Not enough memory / resources.

-3

- Invalid argument.

-8

- The text contains invalid characters.

-10

- Invalid location or dimension.

-11

- The GUI API is not supported.

-12

- The location is already used.

 

Declaration:

FUNCTION guiButtonCreate : INT;
VAR_INPUT
  form   : SYSHANDLE;
  x      : SINT := 1;
  y      : SINT := 1;
  w      : SINT := 1;
  h      : SINT := 1;
  text   : STRING;
  tag    : DINT;
  button : ACCESS SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc     : INT;
  button : SYSHANDLE;
  form   : SYSHANDLE;
END_VAR;
 
BEGIN
  ...
  // Create a button with the text "Click Me"
  rc := guiButtonCreate(button := button, form:=form, x:=2, y:=3, w:=3, h:=1, text := "Click Me", tag:=40);
  ...
END;
END_PROGRAM;