Solution: the problem occurred for two reasons:
- My custom font didn’t have the check glyph and 0xf00c.
- My lv config didn’t enable patterns.
Description
I am using a checkbox. It works well except that it has no visible ‘V’ checkmark sign when checked.
My apps uses only custom fonts and they include only the glyphs it needed. I wonder if LVGL requires that the font that is used for checkbox text should also have that special checkbox mark glyph.
What MCU/Processor/Board and compiler are you using?
STM32
What LVGL version are you using?
#define LVGL_VERSION_MAJOR 7
#define LVGL_VERSION_MINOR 9
#define LVGL_VERSION_PATCH 1
#define LVGL_VERSION_INFO “dev”
What do you want to achieve?
Have the check mark displayed when the checkbox is checked.
What have you tried so far?
Verified my code.
Code to reproduce
I am using this function to create the checkbox.
void create_checkbox(const Screen& screen, lv_coord_t x, lv_coord_t y,
const char* kFootnotText, const lv_font_t* lv_font,
lv_color_t text_color, Checkbox* checkbox) {
lv_obj_t* lv_checkbox = lv_checkbox_create(screen.lv_screen, NULL);
lv_obj_set_pos(lv_checkbox, x, y);
lv_checkbox_set_text(lv_checkbox, kFootnotText);
lv_obj_set_style_local_text_font(lv_checkbox, LV_LABEL_PART_MAIN,
LV_STATE_DEFAULT, lv_font);
lv_obj_set_style_local_text_color(lv_checkbox, LV_LABEL_PART_MAIN,
LV_STATE_DEFAULT, text_color);
lv_obj_set_style_local_outline_width(lv_checkbox, LV_STATE_DEFAULT,
LV_STATE_DEFAULT, 0);
}
Screenshot and/or video
Screenshots with the checkbox non-pressed and pressed, respectively.