Use EVT_KEY_FIRST on Button
This commit is contained in:
+2
-1
@@ -36,7 +36,8 @@ void Button::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("Button").c_str(), event);
|
||||
|
||||
if (enabled && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (enabled && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
onKeyPress();
|
||||
onPress();
|
||||
}
|
||||
|
||||
+5
-3
@@ -28,9 +28,11 @@ constexpr WindowFlags BUTTON_CHECKED_ON_FOCUS = FORM_FLAGS_LAST << 3u;
|
||||
class Button: public FormField
|
||||
{
|
||||
public:
|
||||
Button(FormGroup * parent, const rect_t & rect, std::function<uint8_t(void)> pressHandler = nullptr, WindowFlags windowFlags = 0, LcdFlags textFlags = 0):
|
||||
FormField(parent, rect, windowFlags, textFlags),
|
||||
pressHandler(std::move(pressHandler))
|
||||
Button(FormGroup* parent, const rect_t& rect,
|
||||
std::function<uint8_t(void)> pressHandler = nullptr,
|
||||
WindowFlags windowFlags = 0, LcdFlags textFlags = 0) :
|
||||
FormField(parent, rect, windowFlags, textFlags),
|
||||
pressHandler(std::move(pressHandler))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user