Merge pull request #10 from eshifri/change-sign
Add +/- button to virtual number_edir keyboard.
This commit is contained in:
+8
-2
@@ -64,9 +64,15 @@ NumberKeyboard::NumberKeyboard() :
|
|||||||
return 0;
|
return 0;
|
||||||
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
}, 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 {
|
[=]() -> 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;
|
return 0;
|
||||||
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,6 +134,10 @@ void NumberEdit::onEvent(event_t event)
|
|||||||
case EVT_VIRTUAL_KEY_MIN:
|
case EVT_VIRTUAL_KEY_MIN:
|
||||||
setValue(getMin());
|
setValue(getMin());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVT_VIRTUAL_KEY_SIGN:
|
||||||
|
setValue(-getValue());
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user