Skip to content
Matthias Görges edited this page Jan 26, 2016 · 7 revisions

glgui-label create a Label widget from a string

Parameter Description
g The Graphical User Interface (GUI) belonging to this widget
x The lower left corner along the x-axis in pixels
y The lower left corner along the y-axis in pixels
w The width of the element in pixels
h The height of the element in pixels
label The string for label
fnt The font used to render the label string
color The widget color
bgcolor Optional: The widget background color

Attributes

Besides the parameters set in the procedure, the widget has the following attributes that can be set using glgui-widget-set!:

Attribute Default Value Description
rounded False If true, the background rectangle has rounded corners.
aftercharcb False If set to a procedure and focus is true, then the procedure is called after each character is typed or deleted.
onfocuscb False If set to a procedure and focus is false, then the procedure is called upon first click on the label.

| hidden | False | If true, the widget is not displayed. | | direction | GUI_LEFTTORIGHT | If set to GUI_RIGHTTOLEFT then text is wrapped with the right end of the string on the top line and the left end on the bottom line. | | password | False | If true, each character in the label is rendered as an *. | enableinput | False | If true, clicking on the label will set focus to true. | focus | False | If true, key events such as EVENT_KEYRELEASE and EVENT_KEYBACKSPACE change the contents of the label. | | clearoninput | False | If true and focus is true, the next character entered while will replace the entire contents of the label and clearoninput will be set to false. | | showstart | False | This controls which end of a label's text is visible if the content is too long for the dimensions. If true and align is GUI_ALIGNCENTER the label will show the start of the text instead of the end. If true, align is GUI_ALIGNLEFT, and focus is true, the label will show the start of the text instead of the end. | | align | GUI_ALIGNLEFT | This controls the alignment of the text within the horizontal dimensions of the label. If set to GUI_ALIGNCENTER, the text is centered and if set to GUI_ALIGNRIGHT the text is aligned to the right. |

Example

Example1: Create a cyan colored label that says "100". The widget should have the following specification x=10, x=25, w=40, h=60. It requires a numerics font libary in size 64 to work.

(glgui-label mygui 10 25 40 60 "100" num64.fnt Cyan)
Clone this wiki locally