[Table] Fixes
This commit is contained in:
+5
-1
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user