Hello Mike,
I also could not find out how to properly do it from the documentation, here’s how I do it now in v9. Seems to work well. Code below is for changing the color and alignment of a label based on the column it is in.
static void ev_TabDraw_cb(lv_event_t* event)
{
lv_draw_task_t * draw_task = lv_event_get_draw_task(event);
lv_draw_dsc_base_t * base_dsc = draw_task->draw_dsc;
if(base_dsc->part == LV_PART_ITEMS)
{
uint32_t row = base_dsc->id1;
uint32_t col = base_dsc->id2;
if (draw_task->type == LV_DRAW_TASK_TYPE_LABEL)
{
lv_draw_label_dsc_t* label_dsc = draw_task->draw_dsc;
switch (col) {
case TABLE_COLUMN_FIELD:
label_dsc->align = LV_TEXT_ALIGN_LEFT;
break;
case TABLE_COLUMN_VALUE:
label_dsc->align = LV_TEXT_ALIGN_RIGHT;
break;
case TABLE_COLUMN_UNIT:
label_dsc->align = LV_TEXT_ALIGN_LEFT;
label_dsc->color = lv_color_hex(TABLE_COL_UNIT);
break;
default:
break;
}
}
}