IupLabel
Creates a label interface element, which displays a separator, a text or an image.
Creation
Ihandle* IupLabel(const char *title);
title: Text to be shown on the label. It can be NULL. It will set the TITLE attribute.
Returns: the identifier of the created element, or NULL if an error occurs.
Attributes
ACTIVE: The only difference between an active label and an inactive one is its visual feedback. Possible values: "YES, "NO". Default: "YES".
ALIGNMENT (non-inheritable): horizontal and vertical alignment. Possible values: "ALEFT", "ACENTER" and "ARIGHT", combined to "ATOP", "ACENTER" and "ABOTTOM". Default: "ALEFT:ACENTER". Partial values are also accepted, like "ARIGHT" or ":ATOP", the other value will be obtained from the default value. In Motif, vertical alignment is restricted to "ACENTER".
BGCOLOR: background color. When not defined uses the background color of the native parent, which is transparent.
DROPFILESTARGET (non-inheritable): Enable or disable the drop of files. Default: NO, but if DROPFILES_CB is defined when the element is mapped then it will be automatically enabled.
ELLIPSIS: add an ellipsis: "..." to the text if there is not enough space to render the entire string. Can be "YES" or "NO". Default: "NO". Not supported in Motif.
FGCOLOR: Text color. Default: the global attribute DLGFGCOLOR.
IMAGE (non-inheritable): Image name. If set before map defines the behavior of the label to contain an image. The natural size will be size of the image in pixels. Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. See also IupImage.
IMINACTIVE (non-inheritable): Image name of the element when inactive. If it is not defined then the IMAGE is used and the colors will be replaced by a modified version of the background color creating the disabled effect.
MARKUP: allows the title string to contain markup
commands. Supports a Pango-like subset: <b>,
<i>, <u>, <s>,
<sub>, <sup>,
<big>, <small>, and
<span> with foreground,
background, font_family,
font_size, font_weight,
font_style attributes. GTK uses Pango markup natively;
other drivers convert to their native format. Works only if a mnemonic
is NOT defined in the title. Can be "YES" or "NO". Default: "NO". Not
supported in Win32, FLTK, Motif and Haiku (markup tags are stripped and
plain text is displayed).
PADDING: internal margin. Works just like the MARGIN attribute of the IupHbox and IupVbox containers, but uses a different name to avoid inheritance problems. Not used when SEPARATOR is used. Default value: "0x0".
CPADDING: same as PADDING but using the units of the SIZE attribute. It will actually set the PADDING attribute.
SEPARATOR (creation-only) (non-inheritable): Turns the label into a line separator. Possible values: "HORIZONTAL" or "VERTICAL". When changed before mapping the EXPAND attribute is set to "HORIZONTALFREE" or "VERTICALFREE" accordingly.
TITLE (non-inheritable): Label's text. If SEPARATOR or IMAGE are not defined before map, then the default behavior is to contain a text. The label behavior cannot be changed after map. The natural size will be larger enough to include all the text in the selected font, even using multiple lines. The '\n' character is accepted for line change. The "&" character can be used to define a mnemonic, the next character will be used as key. Use "&&" to show the "&" character instead of defining a mnemonic. The next control from the label will be activated from any control in the dialog using the "Alt+key" combination. The "&" is always consumed (so "&&" shows "&" in all drivers), but the "Alt+key" activation of the next control is only available in Win32, GTK, GTK 4, Motif, EFL and Haiku.
WORDWRAP: enables or disable the wrapping of lines that does not fit in the label. Can be "YES" or "NO". Default: "NO". Can only set WORDWRAP=YES if ALIGNMENT=ALEFT. Not supported in Motif and Haiku.
SELECTABLE (non-inheritable): Makes the label text selectable by the user for copy/paste. Can be "YES" or "NO". Default: "NO". Not supported in Win32, Motif, FLTK, EFL and Haiku.
FONT, EXPAND, SCREENPOSITION, POSITION, MINSIZE, MAXSIZE, WID, TIP, SIZE, RASTERSIZE, ZORDER, VISIBLE, THEME: also accepted.
Drag & Drop attributes and callbacks are supported.
Callbacks
BUTTON_CB: Action generated when any mouse button is pressed or released.
MOTION_CB: Action generated when the mouse is moved.
DROPFILES_CB: Action generated when one or more files are dropped in the element.
MAP_CB, UNMAP_CB, DESTROY_CB, ENTERWINDOW_CB, LEAVEWINDOW_CB: common callbacks are supported.
Notes
Labels with images, texts or line separator cannot change its behavior after mapped. But after map, the image can be changed for another image, and the text for another text.
Examples
| GTK | Qt | Win32 | macOS |
![]() |
![]() |
![]() |
![]() |
Text labels:
- FGCOLOR = "0 0 255", ALIGNMENT = "ALEFT:ATOP"
- FONT = "Helvetica, 14", ALIGNMENT = "ACENTER:ACENTER"
- MARKUP = "YES", ALIGNMENT = "ARIGHT:ABOTTOM"
Image labels:
- 8 bpp image
- 24 bpp image, ALIGNMENT = "ACENTER"
- 32 bpp image, ALIGNMENT = "ARIGHT"



