fix(NumberEdit): do not call setValue() in constructor, use update() instead (#76)

This avoids writing a value when it is not necessary. All that is needed is to update the internal value and set the field string.

Co-authored-by: Raphael Coeffic <raphael.coeffic@frafos.com>
This commit is contained in:
Peter Feerick
2022-10-09 14:40:11 +10:00
committed by GitHub
co-authored by Raphael Coeffic
parent 75087b2c1b
commit df7d9a0fe0
+1 -4
View File
@@ -54,10 +54,7 @@ NumberEdit::NumberEdit(Window* parent, const rect_t& rect, int vmin, int vmax,
lv_textarea_set_one_line(lvobj, true);
lv_obj_add_event_cb(lvobj, numberedit_cb, LV_EVENT_KEY, this);
if (_getValue) {
auto value = _getValue();
this->setValue(value);
}
update();
}
void NumberEdit::onEvent(event_t event)