The EEZ studio initializes and creates screen and buttons:
void create_screen_main() {
lv_obj_t *obj = lv_obj_create(0);
objects.main = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 480, 272);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 356, 232);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "Hello, world!");
}
{
// button1
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.button1 = obj;
lv_obj_set_pos(obj, 62, 86);
lv_obj_set_size(obj, 100, 50);
lv_obj_add_event_cb(obj, action_change_keypad_screen, LV_EVENT_PRESSED, (void *)10);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "0");
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
{
// button2
lv_obj_t *obj = lv_btn_create(parent_obj);
objects.button2 = obj;
lv_obj_set_pos(obj, 275, 94);
lv_obj_set_size(obj, 100, 50);
lv_obj_add_event_cb(obj, action_change_keypad_screen, LV_EVENT_PRESSED, (void *)1);
{
lv_obj_t *parent_obj = obj;
{
lv_obj_t *obj = lv_label_create(parent_obj);
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
lv_label_set_text(obj, "0");
lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT);
}
}
}
}
}
So when I call with a new label
lv_label_set_text(objects.button1, label);
shouldn’t I be referencing the parent button “objects.button1”? Why is the label not getting updated?