pushEvent insteado of putEvent
This commit is contained in:
+7
-7
@@ -30,43 +30,43 @@ NumberKeyboard::NumberKeyboard() :
|
|||||||
{
|
{
|
||||||
new TextButton(this, {LCD_W / 2 - 115, 10, 50, 30}, "<<",
|
new TextButton(this, {LCD_W / 2 - 115, 10, 50, 30}, "<<",
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
putEvent(EVT_VIRTUAL_KEY_BACKWARD);
|
pushEvent(EVT_VIRTUAL_KEY_BACKWARD);
|
||||||
return 0;
|
return 0;
|
||||||
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
||||||
|
|
||||||
new TextButton(this, {LCD_W / 2 - 55, 10, 50, 30}, "-",
|
new TextButton(this, {LCD_W / 2 - 55, 10, 50, 30}, "-",
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
putEvent(EVT_VIRTUAL_KEY_MINUS);
|
pushEvent(EVT_VIRTUAL_KEY_MINUS);
|
||||||
return 0;
|
return 0;
|
||||||
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
||||||
|
|
||||||
new TextButton(this, {LCD_W / 2 + 5, 10, 50, 30}, "+",
|
new TextButton(this, {LCD_W / 2 + 5, 10, 50, 30}, "+",
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
putEvent(EVT_VIRTUAL_KEY_PLUS);
|
pushEvent(EVT_VIRTUAL_KEY_PLUS);
|
||||||
return 0;
|
return 0;
|
||||||
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
||||||
|
|
||||||
new TextButton(this, {LCD_W / 2 + 65, 10, 50, 30}, ">>",
|
new TextButton(this, {LCD_W / 2 + 65, 10, 50, 30}, ">>",
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
putEvent(EVT_VIRTUAL_KEY_FORWARD);
|
pushEvent(EVT_VIRTUAL_KEY_FORWARD);
|
||||||
return 0;
|
return 0;
|
||||||
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
||||||
|
|
||||||
new TextButton(this, {LCD_W / 2 - 115, 50, 50, 30}, "MIN",
|
new TextButton(this, {LCD_W / 2 - 115, 50, 50, 30}, "MIN",
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
putEvent(EVT_VIRTUAL_KEY_MIN);
|
pushEvent(EVT_VIRTUAL_KEY_MIN);
|
||||||
return 0;
|
return 0;
|
||||||
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
||||||
|
|
||||||
new TextButton(this, {LCD_W / 2 + 65, 50, 50, 30}, "MAX",
|
new TextButton(this, {LCD_W / 2 + 65, 50, 50, 30}, "MAX",
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
putEvent(EVT_VIRTUAL_KEY_MAX);
|
pushEvent(EVT_VIRTUAL_KEY_MAX);
|
||||||
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, 110, 30}, "DEFAULT",
|
||||||
[=]() -> uint8_t {
|
[=]() -> uint8_t {
|
||||||
putEvent(EVT_VIRTUAL_KEY_DEFAULT);
|
pushEvent(EVT_VIRTUAL_KEY_DEFAULT);
|
||||||
return 0;
|
return 0;
|
||||||
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
}, BUTTON_BACKGROUND | OPAQUE | NO_FOCUS);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -146,7 +146,7 @@ bool TextKeyboard::onTouchEnd(coord_t x, coord_t y)
|
|||||||
}
|
}
|
||||||
else if (*key == KEYBOARD_SPACE[0]) {
|
else if (*key == KEYBOARD_SPACE[0]) {
|
||||||
if (x <= 135) {
|
if (x <= 135) {
|
||||||
putEvent(EVT_VIRTUAL_KEY(' '));
|
pushEvent(EVT_VIRTUAL_KEY(' '));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
x -= 135;
|
x -= 135;
|
||||||
@@ -164,7 +164,7 @@ bool TextKeyboard::onTouchEnd(coord_t x, coord_t y)
|
|||||||
uint8_t specialKey = *key;
|
uint8_t specialKey = *key;
|
||||||
if (specialKey == 128) {
|
if (specialKey == 128) {
|
||||||
// backspace
|
// backspace
|
||||||
putEvent(EVT_VIRTUAL_KEY(KEYBOARD_BACKSPACE[0]));
|
pushEvent(EVT_VIRTUAL_KEY(KEYBOARD_BACKSPACE[0]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
layout = KEYBOARD_LAYOUTS[specialKey - 129];
|
layout = KEYBOARD_LAYOUTS[specialKey - 129];
|
||||||
@@ -176,7 +176,7 @@ bool TextKeyboard::onTouchEnd(coord_t x, coord_t y)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (x <= 30) {
|
if (x <= 30) {
|
||||||
putEvent(EVT_VIRTUAL_KEY(*key));
|
pushEvent(EVT_VIRTUAL_KEY(*key));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
x -= 30;
|
x -= 30;
|
||||||
|
|||||||
Reference in New Issue
Block a user