Merge pull request #10 from eshifri/change-sign

Add +/- button to virtual number_edir keyboard.
This commit is contained in:
Raphael Coeffic
2021-07-31 18:02:32 +02:00
committed by GitHub
2 changed files with 12 additions and 2 deletions
+8 -2
View File
@@ -64,11 +64,17 @@ NumberKeyboard::NumberKeyboard() :
return 0;
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
new TextButton(this, {LCD_W / 2 - 55, 50, 110, 30}, "DEFAULT",
new TextButton(this, { LCD_W/2 - 55, 50, 50, 30 }, "DEF",
[=]() -> uint8_t {
pushEvent(EVT_VIRTUAL_KEY_DEFAULT);
pushEvent(EVT_VIRTUAL_KEY_DEFAULT);
return 0;
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
new TextButton(this, { LCD_W/2 + 5, 50, 50, 30 }, "+/-",
[=]() -> uint8_t {
pushEvent(EVT_VIRTUAL_KEY_SIGN);
return 0;
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
}
NumberKeyboard::~NumberKeyboard()
+4
View File
@@ -134,6 +134,10 @@ void NumberEdit::onEvent(event_t event)
case EVT_VIRTUAL_KEY_MIN:
setValue(getMin());
break;
case EVT_VIRTUAL_KEY_SIGN:
setValue(-getValue());
break;
#endif
}
}