Cross-platform C SDK logo

Cross-platform C SDK

Label

❮ Back
Next ❯
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.

Functions

Label*label_create (void)
Label*label_multiline (void)
voidlabel_OnClick (...)
voidlabel_text (...)
voidlabel_font (...)
voidlabel_style_over (...)
voidlabel_align (...)
voidlabel_color (...)
voidlabel_color_over (...)
voidlabel_bgcolor (...)
voidlabel_bgcolor_over (...)

Label controls are used to insert small blocks of text into windows and forms. They are of uniform format, that is, the font and color attributes will be applied to the entire text. In most cases the content will be limited to a single line, although it is possible to show blocks that extend in several lines. The control size will be adjusted to the text it contains (Figure 1). In Hello Label! you have an example of use.

In the case that the column of Layout has a width smaller than the text, some dots (ellipse) will be displayed at the clipping point (Figure 2), except in multi-line labels, which will expand vertically to accommodate all text (Figure 3).

Label controls with the width smaller than the text.
Figure 2: Text adjustment by reducing the width of the control.
Multiline label controls.
Figure 3: Multi-line labels will expand vertically to accommodate all text.

In (Figure 4) we have an example of the use of Label in forms. If necessary, we can make the texts sensitive to the mouse by varying their style and colors (Figure 5).

❮ Back
Next ❯

label_create ()

Create a text control.

Label*
label_create(void);

Return

The new label.


label_multiline ()

Create a multi-line text control.

Label*
label_multiline(void);

Return

The new label.


label_OnClick ()

Set the OnClick event handler.

void
label_OnClick(Label *label,
              Listener *listener);
1
2
3
4
5
6
7
static void i_OnClick(App *app, Event *e)
{
    const EvText *p = event_params(e, EvText);
    do_something_onclick(app, p->text);
}
...
label_OnClick(label, listener(app, i_OnClick, App));
label

The label.

listener

Event handler.

Remarks

See GUI Events.


label_text ()

Set the text that the label will display.

void
label_text(Label *label,
           const char_t *text);
label

The label.

text

UTF8 C-string terminated in null character '\0'.


label_font ()

Set the text font.

void
label_font(Label *label,
           const Font *font);
label

The label.

font

Font.


label_style_over ()

Set the font modifiers, when the mouse is over the control.

void
label_style_over(Label *label,
                 const uint32_t style);
label

The label.

style

Combination of values fstyle_t.


label_align ()

Sets the horizontal alignment of the text with respect to the size of the control.

void
label_align(Label *label,
            const align_t align);
label

The label.

align

Alignment.


label_color ()

Set the text color.

void
label_color(Label *label,
            const color_t color);
label

The label.

color

The color.

Remarks

RGB values may not be fully portable. See Colors.


label_color_over ()

Set the color of the text, when the mouse is over the control.

void
label_color_over(Label *label,
                 const color_t color);
label

The label.

color

The color.

Remarks

RGB values may not be fully portable. See Colors.


label_bgcolor ()

Set the background color of the text.

void
label_bgcolor(Label *label,
              const color_t color);
label

The label.

color

The color.

Remarks

RGB values may not be fully portable. See Colors.


label_bgcolor_over ()

Set the background color of the text, when the mouse is over the control.

void
label_bgcolor_over(Label *label,
                   const color_t color);
label

The label.

color

El color.

Remarks

RGB values may not be fully portable. See Colors.

❮ Back
Next ❯