diff --git a/radio/src/thirdparty/libopenui/src/flexlayout.h b/radio/src/thirdparty/libopenui/src/flexlayout.h index 4d2fa2ee8..756d1d201 100644 --- a/radio/src/thirdparty/libopenui/src/flexlayout.h +++ b/radio/src/thirdparty/libopenui/src/flexlayout.h @@ -61,11 +61,20 @@ class FlexGridLayout } } - void nextColumn() { col_pos++; } - void nextRow() { row_pos++; } - void resetPos() { col_pos = 0; row_pos = 0; } + void nextColumn() { col_pos += col_span; } + void nextRow() { row_pos += row_span; } + + void nextCell() + { + nextColumn(); + if (col_dsc[col_pos] == LV_GRID_TEMPLATE_LAST) { + nextRow(); + col_pos = 0; + } + } + void setColSpan(uint8_t span) { col_span = span; } void setRowSpan(uint8_t span) { row_span = span; } }; diff --git a/radio/src/thirdparty/libopenui/src/form.cpp b/radio/src/thirdparty/libopenui/src/form.cpp index daa2706af..5bedb2009 100644 --- a/radio/src/thirdparty/libopenui/src/form.cpp +++ b/radio/src/thirdparty/libopenui/src/form.cpp @@ -141,7 +141,7 @@ void FormGroup::Line::addChild(Window* window, bool front) Window::addChild(window, front); if (layout) { layout->add(window->getLvObj()); - layout->nextColumn(); + layout->nextCell(); } } @@ -205,7 +205,7 @@ void FormGroup::setFlexLayout(lv_flex_flow_t flow, lv_coord_t padding) FormGroup::Line* FormGroup::newLine(FlexGridLayout* layout) { - layout->resetPos(); + if (layout) layout->resetPos(); auto lv_line = lv_obj_create(lvobj); return new Line(this, lv_line, layout); } diff --git a/radio/src/thirdparty/libopenui/src/form.h b/radio/src/thirdparty/libopenui/src/form.h index 4ef75f583..6e2952571 100644 --- a/radio/src/thirdparty/libopenui/src/form.h +++ b/radio/src/thirdparty/libopenui/src/form.h @@ -152,7 +152,7 @@ class FormGroup : public FormField, public FieldContainer void clear(); void setFlexLayout(lv_flex_flow_t flow = LV_FLEX_FLOW_COLUMN, lv_coord_t padding = 0); - Line* newLine(FlexGridLayout* layout); + Line* newLine(FlexGridLayout* layout = nullptr); void setFocus(uint8_t flag = SET_FOCUS_DEFAULT, Window *from = nullptr) override;