diff --git a/radio/src/thirdparty/libopenui/src/table.cpp b/radio/src/thirdparty/libopenui/src/table.cpp index 76dfd3362..d83488ae4 100644 --- a/radio/src/thirdparty/libopenui/src/table.cpp +++ b/radio/src/thirdparty/libopenui/src/table.cpp @@ -65,17 +65,21 @@ void TableField::clicked(lv_event_t *e) TableField* tf = (TableField*)lv_obj_get_user_data(target); if (!tf) return; + uint16_t row; + uint16_t col; + lv_table_get_selected_cell(target, &row, &col); + if (row == LV_TABLE_CELL_NONE || col == LV_TABLE_CELL_NONE) + return; + lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act()); if(indev_type == LV_INDEV_TYPE_ENCODER) { // Encoder send VALUE_CHANGED when selection changes tf->adjustScroll(); + tf->onSelected(row, col); } else { // Otherwise it's a click if (lv_group_get_editing((lv_group_t*)lv_obj_get_group(target)) || indev_type == LV_INDEV_TYPE_POINTER) { - uint16_t row; - uint16_t col; - lv_table_get_selected_cell(target, &row, &col); tf->onPress(row, col); } else { @@ -261,15 +265,6 @@ void TableField::onEvent(event_t event) onKeyPress(); selectNext(-1); } - // else if (event == EVT_KEY_BREAK(KEY_ENTER)) { - // onKeyPress(); - - // uint16_t row; - // uint16_t col; - // lv_table_get_selected_cell(lvobj, &row, &col); - - // onPress(row, col); - // } else { Window::onEvent(event); } diff --git a/radio/src/thirdparty/libopenui/src/table.h b/radio/src/thirdparty/libopenui/src/table.h index 142d6534e..520915231 100644 --- a/radio/src/thirdparty/libopenui/src/table.h +++ b/radio/src/thirdparty/libopenui/src/table.h @@ -48,6 +48,7 @@ class TableField : public Window void selectNext(int16_t dir); void onEvent(event_t event) override; + virtual void onSelected(uint16_t row, uint16_t col) {} virtual void onDrawBegin(uint16_t row, uint16_t col, lv_obj_draw_part_dsc_t* dsc) {} virtual void onDrawEnd(uint16_t row, uint16_t col, lv_obj_draw_part_dsc_t* dsc) {}