Description
What MCU/Processor/Board and compiler are you using?
ESP32, VSCode/PlatformIO
What do you want to achieve?
I have a Window with multiple screen filling pages aligned vertically that scroll from top to bottom as the focus gets shifted with Up/Down/Enter buttons. No Touchscreen.
On one page I need to have a container that contains a list of containers that is longer than fits the screen. I am planning to just create a page sized appropriately for the available screen and have the list scroll inside that subpage. However, this page never scrolls, it is always the main page that scrolls. I’d like to only have the main page scroll once focus jumps from the last element of the list to the next page. As long as the focus is on a list element, i’d like to have the nested page scroll.
What have you tried so far?
Really all kinds of configuarations and settings. Reading through documentation of virtually every function that exists. Maybe Noteworthy, calling lv_cont_set_fit2(lvContainer, LV_FIT_NONE, LV_FIT_FILL);
on the parent container crashes the Esp32 when it creates another container inside the parent container.
Code to reproduce
void AltiGuiGPS_Satellite::create(lv_obj_t* parent, lv_group_t *_focusGroup, uint8_t id) {
Serial.println("creating satellite");
this->parent = parent;
this->focusGroup = _focusGroup;
lvContainer = lv_cont_create(this->parent, NULL);
lv_obj_set_width(lvContainer, LV_HOR_RES_MAX-20);
lv_obj_set_height(lvContainer, SAT_CONT_HEIGHT);
lv_group_add_obj(focusGroup, lvContainer);
lbl_id = lv_label_create(lvContainer, NULL);
lv_label_set_text(lbl_id, String(id).c_str());
lv_obj_align(lbl_id, lvContainer, LV_ALIGN_IN_LEFT_MID, 10, 0);
lv_obj_set_style(lbl_id, &lv_style_plain);
lbl_elev = lv_label_create(lvContainer, NULL);
lv_label_set_text(lbl_elev, "ele");
lv_obj_align(lbl_elev, lvContainer, LV_ALIGN_IN_LEFT_MID, 30, 0);
lv_obj_set_style(lbl_elev, &lv_style_plain);
lbl_azimuth = lv_label_create(lvContainer, NULL);
lv_label_set_text(lbl_azimuth, "azi");
lv_obj_align(lbl_azimuth, lvContainer, LV_ALIGN_IN_LEFT_MID, 70, 0);
lv_obj_set_style(lbl_azimuth, &lv_style_plain);
lbl_snr = lv_label_create(lvContainer, NULL);
lv_label_set_text(lbl_snr, "snr");
lv_obj_align(lbl_snr, lvContainer, LV_ALIGN_IN_LEFT_MID, 110, 0);
lv_obj_set_style(lbl_snr, &lv_style_plain);
snrBar = lv_bar_create(lvContainer, NULL);
lv_obj_set_size(snrBar, 120, 16);
lv_bar_set_range(snrBar, 0, 60);
lv_obj_align(snrBar, lvContainer, LV_ALIGN_IN_RIGHT_MID, -10, 0);
lv_bar_set_anim_time(snrBar, 1000);
lv_bar_set_value(snrBar, 30, LV_ANIM_ON);
}
void AltiGuiGPS::create(lv_obj_t *parent, lv_group_t *_focusGroup) {
this->parent = parent;
this->focusGroup = _focusGroup;
lvContainer = lv_cont_create(this->parent, NULL);
lv_obj_set_width(lvContainer, LV_HOR_RES_MAX);
lv_obj_set_height(lvContainer, 220);
lv_group_add_obj(focusGroup, lvContainer);
// On/Off Checkbox
onOffCheckbox = lv_cb_create(this->lvContainer, NULL); // First check box
lv_cb_set_text(onOffCheckbox, "GPS On");
lv_obj_align(onOffCheckbox, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_group_add_obj(this->focusGroup, this->onOffCheckbox);
lv_obj_set_event_cb(onOffCheckbox, lvcb_GPSonOffCheckboxHandler);
lv_cb_set_checked(onOffCheckbox, Data.gpsEnabled);
static lv_style_t cbStyle;
lv_style_copy(&cbStyle, lv_obj_get_style(this->onOffCheckbox));
cbStyle.text.font = &lv_font_roboto_28;
lv_obj_set_style(this->onOffCheckbox, &cbStyle);
// status label
lv_obj_t *cont_Status = lv_cont_create(lvContainer, NULL);
lv_obj_set_style(cont_Status, &lv_style_plain);
lv_obj_set_height(cont_Status, 30);
lv_obj_set_width(cont_Status, LV_HOR_RES_MAX-20);
lv_obj_align(cont_Status, onOffCheckbox, LV_ALIGN_OUT_BOTTOM_LEFT, 10, 0);
lbl_Status = lv_label_create(cont_Status, NULL);
lv_label_set_text(lbl_Status, "Status");
lv_obj_align(lbl_Status, cont_Status, LV_ALIGN_IN_LEFT_MID, 0, 0);
// satellites page
lv_obj_t *cont_Satellites = lv_page_create(lvContainer, NULL);
lv_obj_set_height(cont_Satellites, 120);
lv_obj_set_width(cont_Satellites, LV_HOR_RES_MAX);
lv_obj_align(cont_Satellites, cont_Status, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
lv_page_set_scrl_fit2(cont_Satellites, LV_FIT_NONE, LV_FIT_FILL);
for (int i = 0; i < 20;i++) {
satellites[i].create(cont_Satellites, focusGroup, i);
lv_obj_align(satellites[i].lvContainer, cont_Satellites, LV_ALIGN_IN_TOP_LEFT, 0, i * SAT_CONT_HEIGHT);
}
}
Screenshot and/or video
Video scrolling down, illustrating the problem: https://imgur.com/a/8DvWJD4