Label
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) |
void | label_OnClick (...) |
void | label_text (...) |
void | label_font (...) |
void | label_style_over (...) |
void | label_align (...) |
void | label_color (...) |
void | label_color_over (...) |
void | label_bgcolor (...) |
void | label_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.
- Use label_create to create a text control.
- Use label_multiline to create a multi-line control.
- Use label_align to set the internal alignment of the text.
- Use label_font to set the font.
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).
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).
- Use label_style_over to change the font style.
- Use label_color_over to change text color.
- Use label_bgcolor_over to change background color.
- Use label_OnClick to respond to a click on the text.
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(UserData *data, Event *e) { const EvText *p = event_params(e, EvText); do_something_onclick(data, p->text); } ... label_OnClick(label, listener(data, i_OnClick, UserData)); |
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 |
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.