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:
committed by
GitHub
co-authored by
Raphael Coeffic
parent
75087b2c1b
commit
df7d9a0fe0
+1
-4
@@ -54,10 +54,7 @@ NumberEdit::NumberEdit(Window* parent, const rect_t& rect, int vmin, int vmax,
|
|||||||
lv_textarea_set_one_line(lvobj, true);
|
lv_textarea_set_one_line(lvobj, true);
|
||||||
lv_obj_add_event_cb(lvobj, numberedit_cb, LV_EVENT_KEY, this);
|
lv_obj_add_event_cb(lvobj, numberedit_cb, LV_EVENT_KEY, this);
|
||||||
|
|
||||||
if (_getValue) {
|
update();
|
||||||
auto value = _getValue();
|
|
||||||
this->setValue(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NumberEdit::onEvent(event_t event)
|
void NumberEdit::onEvent(event_t event)
|
||||||
|
|||||||
Reference in New Issue
Block a user