Trigger LV_EVENT_FOCUSED with grid navigation

Description

I have a lv_list with a LV_FLEX_FLOW_COLUMN layout and added grid navigation with LV_GRIDNAV_CTRL_NONE to it. Grid navigation seems to work correctly and focuses the list buttons and scrolls the lv_list automatically if the next button is not visible. The list buttons changed their style but do not receive LV_EVENT_FOCUSED. All other events get triggered e.g. LV_EVENT_RELEASED.

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

esp32s3 with the latest ESP-IDF

What LVGL version are you using?

8.3.3

What do you want to achieve?

Trigger LV_EVENT_FOCUSED when a list button gets focused by grid navigation

What have you tried so far?

  • lv_list
    • with LV_FLEX_FLOW_COLUMN
    • and grid navigation (LV_GRIDNAV_CTRL_NONE)
  • List buttons
    • Removed the buttons from their groups withlv_group_remove_obj()
    • The buttons are LV_OBJ_FLAG_CLICKABLE
    • but not LV_OBJ_FLAG_CLICK_FOCUSABLE

Code to reproduce

void drawList()
{
	lv_obj_t *list = lv_list_create(panel);
	lv_obj_set_flex_flow(list, LV_FLEX_FLOW_COLUMN);

	lv_group_add_obj(lv_group_get_default(), list);
	lv_gridnav_add(list, LV_GRIDNAV_CTRL_NONE);

	lv_obj_clear_flag(list, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_CLICK_FOCUSABLE);
}

static void addListButton()
{
	lv_obj_t *listBtn = lv_list_add_btn(list, NULL, buttonName);

	lv_obj_t *lbl = lv_obj_get_child(listBtn, 0);
	lv_label_set_long_mode(lbl, LV_LABEL_LONG_DOT);

	lv_obj_add_event_cb(listBtn, listButtonEvent, LV_EVENT_ALL, NULL);

	lv_obj_add_flag(listBtn, LV_OBJ_FLAG_CLICKABLE);
	lv_obj_clear_flag(listBtn, LV_OBJ_FLAG_CLICK_FOCUSABLE);
	lv_obj_clear_flag(listBtn, LV_OBJ_FLAG_SCROLL_CHAIN_HOR | LV_OBJ_FLAG_SCROLL_CHAIN_VER);

	lv_group_remove_obj(listBtn);
}

static void listButtonEvent(lv_event_t *e)
{
	if(lv_event_get_code(e) == LV_EVENT_FOCUSED)
	{
		// do samething e.g change text size of list button
	}
}

Screenshot and/or video

lv_list