1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

add lv_cb_set_static_text function

This commit is contained in:
canardos 2019-03-01 15:25:29 +08:00
parent fbeb1d785c
commit 4608f72098
2 changed files with 25 additions and 4 deletions

View File

@ -120,9 +120,10 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy)
*====================*/
/**
* Set the text of a check box
* Set the text of a check box. `txt` will be copied and may be deallocated
* after this function returns.
* @param cb pointer to a check box
* @param txt the text of the check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_cb_set_text(lv_obj_t * cb, const char * txt)
{
@ -130,6 +131,17 @@ void lv_cb_set_text(lv_obj_t * cb, const char * txt)
lv_label_set_text(ext->label, txt);
}
/**
* Set the text of a check box. `txt` must not be deallocated during the life
* of this checkbox.
* @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_cb_set_static_text(lv_obj_t * cb, const char * txt) {
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);
lv_label_set_static_text(ext->label, txt);
}
/**
* Set a style of a check box
* @param cb pointer to check box object

View File

@ -78,12 +78,21 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy);
*====================*/
/**
* Set the text of a check box
* Set the text of a check box. `txt` will be copied and may be deallocated
* after this function returns.
* @param cb pointer to a check box
* @param txt the text of the check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_cb_set_text(lv_obj_t * cb, const char * txt);
/**
* Set the text of a check box. `txt` must not be deallocated during the life
* of this checkbox.
* @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_cb_set_static_text(lv_obj_t * cb, const char * txt);
/**
* Set the state of the check box
* @param cb pointer to a check box object