Cosmetics

This commit is contained in:
Bertrand Songis
2019-10-05 19:35:52 +02:00
parent f23021226d
commit e7773df205
2 changed files with 6 additions and 2 deletions
+3 -2
View File
@@ -32,17 +32,18 @@ void NumberEdit::paint(BitmapBuffer * dc)
{ {
FormField::paint(dc); FormField::paint(dc);
auto value = getValue();
LcdFlags textColor; LcdFlags textColor;
if (editMode) if (editMode)
textColor = FOCUS_COLOR; textColor = FOCUS_COLOR;
else if (hasFocus()) else if (hasFocus())
textColor = FOCUS_BGCOLOR; textColor = FOCUS_BGCOLOR;
else if (enabled) else if (enabled && (value != 0 || zeroText.empty()))
textColor = DEFAULT_COLOR; textColor = DEFAULT_COLOR;
else else
textColor = DISABLE_COLOR; textColor = DISABLE_COLOR;
int32_t value = getValue();
if (displayFunction) if (displayFunction)
displayFunction(dc, textColor, value); displayFunction(dc, textColor, value);
else if (value == 0 && !zeroText.empty()) else if (value == 0 && !zeroText.empty())
+3
View File
@@ -44,6 +44,9 @@ void TextEdit::paint(BitmapBuffer * dc)
const char * displayedValue = value; const char * displayedValue = value;
LcdFlags textColor; LcdFlags textColor;
if (hasFocus()) { if (hasFocus()) {
if (strlen(value) == 0) {
displayedValue = "---";
}
textColor = FOCUS_BGCOLOR; textColor = FOCUS_BGCOLOR;
} }
else { else {