Hello!
I would like to change dinamically icons on the buttons which are on the lv_list.
I create buttons like it is written in documentation
lv_list_add_btn(list1, LV_ICON_CALL, "kot3");
And I am not able to change the icon because there are only 4 functions for list widget: lv_list_create, lv_list_add_text, lv_list_add_btn and lv_list_get_btn_text
So, I decided to re-create the button (find the button with text “kot3”, remove it and create again with another icon).
So, the code is:
uint32_t i;
for(i = 0; i < lv_obj_get_child_cnt(list1); i++) {
lv_obj_t * child = lv_obj_get_child(list1, i);
char * s = (char*)lv_list_get_btn_text(list1, child);
Serial.println(s);
if (!strcmp(s, "kot3")){
lv_obj_del(child);
lv_obj_t * btn;
btn = lv_list_add_btn(list1, LV_SYMBOL_EYE_OPEN, s); // I also tried (const char*)s
};
But now I see kot3 in serial and hT?ht?dp? on the screen
I also think that the icon is the first child of the element and I should re-create it and move background. Is it right?
What MCU/Processor/Board and compiler are you using?
Arduino IDE + ESP32 + LCD display
What LVGL version are you using?
8.3
Screenshot and/or video
later…