[Table] Fixes

This commit is contained in:
Bertrand Songis
2020-09-14 16:44:09 +02:00
parent 14b65cae3d
commit e0d3f2bb56
2 changed files with 9 additions and 1 deletions
+5 -1
View File
@@ -38,7 +38,7 @@ void Table::Body::paint(BitmapBuffer * dc)
coord_t x;
int index = 0;
for (auto & line: lines) {
bool highlight = hasFocus() && index == selection;
bool highlight = (index == selection);
dc->drawSolidFilledRect(0, y, width(), TABLE_LINE_HEIGHT - 2, highlight ? MENU_HIGHLIGHT_BGCOLOR : TABLE_BGCOLOR);
x = 10;
for (unsigned i = 0; i < line.values.size(); i++) {
@@ -98,6 +98,10 @@ void Table::Body::onEvent(event_t event)
onSelect();
}
}
else if (event == EVT_KEY_BREAK(KEY_EXIT) && selection >= 0) {
select(-1, true);
Window::onEvent(event);
}
else {
Window::onEvent(event);
}
+4
View File
@@ -176,6 +176,10 @@ class Table: public FormField {
void setFocus(uint8_t flag) override
{
if (body.selection < 0) {
body.selection = 0;
body.invalidate();
}
body.setFocus(flag);
}