Hello,
Been playing with tables, and I’d like to be able to click a cell and have the event handler know what cell it was (id). But have been unsuccessfull so far. I’ve searched the forum with no success and I’ve read the docu for the tables. So far I’ve tried the below code, but it will actually spit out all the cell ID’s.
static void settingsTable_handler(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_target(e);
lv_obj_draw_part_dsc_t * dsc = lv_event_get_param(e);
//if(code == LV_EVENT_CLICKED) {
/*If the cells are drawn...*/
if(dsc->part == LV_PART_ITEMS) {
uint32_t row = dsc->id / lv_table_get_col_cnt(obj);
uint32_t col = dsc->id - row * lv_table_get_col_cnt(obj);
Serial.print(dsc->id);
}
//}
}