How do I connect a button signal to a change_event_cb()?

Description

What MCU/Processor/Board and compiler are you using?

Simulation with the help of ZephyrProject.

What LVGL version are you using?

8.3

What do you want to achieve?

There are buttons (up & down) and with them I want to navigate through a table and also highlight the “active” row.

What have you tried so far?

The example is a good starting point.
I can create a table, fill in some rows, the alternating background (white, grey) works.
Then I reduced the table to a single column and extended the example with

if(row == row_highlighted)
{
	dsc->rect_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_BLUE), dsc->rect_dsc->bg_color, LV_OPA_10);
	dsc->rect_dsc->bg_opa = LV_OPA_COVER;
}

Now the first row gets a blue background. But the draw_event_cb() is just for the initial drawing (right?), so I needed another event. I chose change_event_cb()

static void change_event_cb(lv_event_t * e)
{
	lv_obj_t * obj = lv_event_get_target(e);
	lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
	// if the cells are drawn...
	if(dsc != NULL) //MUST, otherwise crash
	{
	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);

		// make every 2nd row grayish
		if((row != 0 && row % 2) == 0)
		{
			dsc->rect_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_GREY), dsc->rect_dsc->bg_color, LV_OPA_10);
			dsc->rect_dsc->bg_opa = LV_OPA_COVER;
		}
		if(row == row_highlighted)
		{
			dsc->rect_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_BLUE), dsc->rect_dsc->bg_color, LV_OPA_10);
			dsc->rect_dsc->bg_opa = LV_OPA_COVER;
		}
	}
	}
}

In general it’s working. But I have to click on a button first and then also on the table. The final application doesn’t have a touch screen, so I need to trigger this “table was clicked”-event by hand.

How do I do that?

Got it.

//table setup code
lv_obj_add_event_cb(table, change_event_cb, LV_EVENT_RELEASED, NULL);
//button input handler
if(gpio_btn_up_get())
{
row_highlighted--;
lv_event_send(table, LV_EVENT_RELEASED, 0);
}

I also tried LV_EVENT_PRESSED and LV_EVENT_CLICKED but only LV_EVENT_RELEASED worked.

Is there a better way to do this?
I’m just wondering, because without the NULL-pointer check, the program crashes. And the example doesn’t have that check…

static void change_event_cb(lv_event_t * e)
{
	lv_obj_t * obj = lv_event_get_target(e);
	lv_obj_draw_part_dsc_t * dsc = lv_event_get_draw_part_dsc(e);
	// if the cells are drawn...
	if(dsc != NULL) //<------ this one
	{