[Checkbox] Fix when disabled

This commit is contained in:
Bertrand Songis
2021-04-06 08:47:09 +02:00
parent d8564e3661
commit 9858ce217e
2 changed files with 4 additions and 6 deletions
+1 -3
View File
@@ -36,12 +36,10 @@ void Button::onEvent(event_t event)
{ {
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("Button").c_str(), event); TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("Button").c_str(), event);
if (event == EVT_KEY_BREAK(KEY_ENTER)) { if (enabled && event == EVT_KEY_BREAK(KEY_ENTER)) {
if (enabled) {
onKeyPress(); onKeyPress();
onPress(); onPress();
} }
}
else { else {
FormField::onEvent(event); FormField::onEvent(event);
} }
+1 -1
View File
@@ -30,7 +30,7 @@ void CheckBox::onEvent(event_t event)
{ {
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("CheckBox").c_str(), event); TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("CheckBox").c_str(), event);
if (event == EVT_KEY_BREAK(KEY_ENTER)) { if (enabled && event == EVT_KEY_BREAK(KEY_ENTER)) {
onKeyPress(); onKeyPress();
_setValue(!getValue()); _setValue(!getValue());
invalidate(); invalidate();