From 8ed3374bccf8f1b308fb1b616f88d3f98f107e46 Mon Sep 17 00:00:00 2001 From: philmoz Date: Fri, 13 Jun 2025 11:04:54 +1000 Subject: [PATCH] fix(color): choice button display not updating if values list changed (#6354) --- radio/src/gui/colorlcd/libui/choice.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/radio/src/gui/colorlcd/libui/choice.cpp b/radio/src/gui/colorlcd/libui/choice.cpp index 22cadec08..f39ba540c 100644 --- a/radio/src/gui/colorlcd/libui/choice.cpp +++ b/radio/src/gui/colorlcd/libui/choice.cpp @@ -131,17 +131,15 @@ Choice::Choice(Window* parent, const rect_t& rect, const char* const values[], ChoiceBase(parent, rect, vmin, vmax, title, getValue, setValue, CHOICE_TYPE_DROPOWN) { setValues(values); - update(); } Choice::Choice(Window* parent, const rect_t& rect, std::vector values, int vmin, int vmax, std::function getValue, std::function setValue, const char* title) : - ChoiceBase(parent, rect, vmin, vmax, title, getValue, setValue, CHOICE_TYPE_DROPOWN), - values(std::move(values)) + ChoiceBase(parent, rect, vmin, vmax, title, getValue, setValue, CHOICE_TYPE_DROPOWN) { - update(); + setValues(values); } void Choice::addValue(const char* value) @@ -153,6 +151,8 @@ void Choice::addValue(const char* value) void Choice::setValues(std::vector values) { this->values = std::move(values); + currentValue = INT_MAX; // Force update + update(); } void Choice::setValues(const char* const values[]) @@ -164,6 +164,8 @@ void Choice::setValues(const char* const values[]) this->values.emplace_back(*value++); } } + currentValue = INT_MAX; // Force update + update(); } void Choice::setValue(int val)