diff --git a/src/UI/UI_combobox.cpp b/src/UI/UI_combobox.cpp index a7bd746..8b33835 100644 --- a/src/UI/UI_combobox.cpp +++ b/src/UI/UI_combobox.cpp @@ -52,6 +52,15 @@ std::string UI_combobox::selected_text() const void UI_combobox::from_json(const json& j) { UI_x_boxes::from_json(j); + std::string selected_str = j.at("selected"); + for (size_t i = 0; i < m_options.size(); i++) + { + if (m_options[i] == selected_str) + { + m_selected = i; + break; + } + } } json UI_combobox::to_json() const diff --git a/src/UI/UI_led.cpp b/src/UI/UI_led.cpp index fa4a457..4a9ac89 100644 --- a/src/UI/UI_led.cpp +++ b/src/UI/UI_led.cpp @@ -7,7 +7,8 @@ m_led_color(led_color) } -UI_led::UI_led(const json& j) : UI_item(j) +UI_led::UI_led(const json& j) : +UI_item(UI_LED_TYPE) { from_json(j); }