fix(color): Model quick select not working (#4369)

This commit is contained in:
philmoz
2023-11-30 09:04:07 +10:00
committed by GitHub
parent 3971a70d26
commit f8106de871
+7 -4
View File
@@ -67,12 +67,11 @@ class ModelButton : public Button
ModelButton(FormWindow *parent, const rect_t &rect, ModelCell *modelCell, ModelButton(FormWindow *parent, const rect_t &rect, ModelCell *modelCell,
std::function<void()> setSelected) : std::function<void()> setSelected) :
Button(parent, rect, nullptr, 0, 0, etx_button_create), Button(parent, rect, nullptr, 0, 0, etx_button_create),
modelCell(modelCell) modelCell(modelCell),
m_setSelected(std::move(setSelected))
{ {
padAll(0); padAll(0);
m_setSelected = std::move(setSelected);
lv_obj_clear_flag(lvobj, LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_clear_flag(lvobj, LV_OBJ_FLAG_CLICK_FOCUSABLE);
setWidth(MODEL_SELECT_CELL_WIDTH); setWidth(MODEL_SELECT_CELL_WIDTH);
setHeight(MODEL_SELECT_CELL_HEIGHT); setHeight(MODEL_SELECT_CELL_HEIGHT);
@@ -134,6 +133,8 @@ class ModelButton : public Button
{ {
if (!lv_obj_has_state(lvobj, LV_STATE_FOCUSED)) { if (!lv_obj_has_state(lvobj, LV_STATE_FOCUSED)) {
lv_group_focus_obj(lvobj); lv_group_focus_obj(lvobj);
} else {
if (m_setSelected) m_setSelected();
} }
} }
@@ -533,6 +534,7 @@ void ModelLabelsWindow::onPressPG(bool isNext)
sellist.insert(select); sellist.insert(select);
lblselector->setSelected(sellist); // Check the items lblselector->setSelected(sellist); // Check the items
lblselector->setSelected(-1); // Force update
lblselector->setSelected(select); // Causes the list to scroll lblselector->setSelected(select); // Causes the list to scroll
updateFilteredLabels(sellist); // Update the models updateFilteredLabels(sellist); // Update the models
} }
@@ -662,7 +664,8 @@ void ModelLabelsWindow::buildBody(FormWindow *window)
#endif #endif
lv_obj_set_grid_cell(box->getLvObj(), LV_GRID_ALIGN_STRETCH, 0, 1, lv_obj_set_grid_cell(box->getLvObj(), LV_GRID_ALIGN_STRETCH, 0, 1,
LV_GRID_ALIGN_STRETCH, LABELS_ROW, 1); LV_GRID_ALIGN_STRETCH, LABELS_ROW, 1);
lblselector = new ListBox(box, rect_t{0, 0, LV_PCT(100), LV_PCT(100)}, getLabels()); lblselector =
new ListBox(box, rect_t{0, 0, LV_PCT(100), LV_PCT(100)}, getLabels());
auto lbl_obj = lblselector->getLvObj(); auto lbl_obj = lblselector->getLvObj();
// Sort Buttons // Sort Buttons