guiLabelCreate (Function)

Top  Previous  Next

Architecture:

NX32L

Firmware version:

1.00.00


This function creates a new label on the provided form.gui_label

Labels can be used to display text to the user, either as a description for another control, or to show e.g. status messages.

 

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

 

Input:

form : SYSHANDLE

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

 

x : SINT default 1

The horizontal location of the label.

 

y : SINT default 1

The vertical location of the label.

 

w : SINT default 1

The width of the label.

 

h : SINT default 1

The height of the label.

 

text : STRING

The text for the label to show.

 

tag : DINT

The tag value to store.

 

valign : SINT default 0

The vertical alignment of the text in the label.

 0        - Left aligned.

 1        -  Centered.

 2        -  Right aligned.

 

border : SINT default 0

The border type for the label.

 0        - No border.

 1        - Thin border.

 

Output:

label : SYSHANDLE

The handle to the new label.

 

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 guiLabelCreate INT;
VAR_INPUT
   form   SYSHANDLE;
   x      : SINT := 1;
   y      : SINT := 1;
   w      : SINT := 1;
   h      : SINT := 1;
   text   STRING;
   tag    : DINT;
   valign SINT := 0;
   border SINT := 0;
   label  : ACCESS SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
   rc    : INT;
   label : SYSHANDLE;
   form  : SYSHANDLE;
END_VAR;
 
BEGIN
   ...
   // Create a label with the text "Label"
   rc := guiLabelCreate(label := labelform:=formx:=2y:=3w:=3h:=1text := "Label", tag:=45);
   ...
END;
END_PROGRAM;