base number edit: streamlined code a bit

This commit is contained in:
Raphael Coeffic
2022-06-12 11:30:56 +02:00
parent ae6f7b55d3
commit cda44291f7
+5 -3
View File
@@ -88,12 +88,14 @@ class BaseNumberEdit: public FormField
}
}
if (lvobj != nullptr) {
std::string str;
if (displayFunction != nullptr) {
lv_textarea_set_text(lvobj, displayFunction(currentValue).c_str());
str = displayFunction(currentValue);
} else {
auto dispString = formatNumberAsString(currentValue, textFlags, 0, prefix.c_str(), suffix.c_str());
lv_textarea_set_text(lvobj, dispString.c_str());
str = formatNumberAsString(currentValue, textFlags, 0, prefix.c_str(),
suffix.c_str());
}
lv_textarea_set_text(lvobj, str.c_str());
}
}