From 4608f72098eff89856e3bc09c01bad788612109b Mon Sep 17 00:00:00 2001 From: canardos Date: Fri, 1 Mar 2019 15:25:29 +0800 Subject: [PATCH 1/2] add lv_cb_set_static_text function --- lv_objx/lv_cb.c | 16 ++++++++++++++-- lv_objx/lv_cb.h | 13 +++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lv_objx/lv_cb.c b/lv_objx/lv_cb.c index e6fc49454..63a8005ce 100644 --- a/lv_objx/lv_cb.c +++ b/lv_objx/lv_cb.c @@ -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 diff --git a/lv_objx/lv_cb.h b/lv_objx/lv_cb.h index b58773341..45f33ee87 100644 --- a/lv_objx/lv_cb.h +++ b/lv_objx/lv_cb.h @@ -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 From 2ffb0a83b07e34e2e7b2d4599e0229269cfb4dfd Mon Sep 17 00:00:00 2001 From: canardos Date: Fri, 1 Mar 2019 15:56:27 +0800 Subject: [PATCH 2/2] Fix incorrect kb_ctrl_num_map --- lv_objx/lv_kb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lv_objx/lv_kb.c b/lv_objx/lv_kb.c index 01f654681..a5545bcfa 100644 --- a/lv_objx/lv_kb.c +++ b/lv_objx/lv_kb.c @@ -82,6 +82,7 @@ static const char * kb_map_num[] = { }; static const lv_btnm_ctrl_t kb_ctrl_num_map[] = { + 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1