How to catch Keypad event to do different action by myself?


I have several different pages in my 1.8inch tft screen, I use keypad with UP, DOWN, ENTER, RETURN to control it, but I want differrent action in different page,
for example: In main menu page I want UP DOWN to switch menu select, In Information page I want UP DOWN to scroll page, In test page I want UP DOWN to switch my test target, how can I realize it ?
Is it necessary to create a widget to respond physical keying ?

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

stm32f407,keil v5 , spi tft rgb screen,

What LVGL version are you using?


What do you want to achieve?

can any Big God give me some good idea ?

What have you tried so far?

In my test page are some lables there,I tried code below but I cannot receive key event in Key_event_cb but only ENTER.

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/
       hTestWin = lv_obj_create(NULL);
	lv_obj_set_size(hTestWin, LV_PCT(100),  LV_PCT(100));
	lv_obj_set_flex_flow(hTestWin, LV_FLEX_FLOW_COLUMN);

	//Write style for screen, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
	lv_obj_set_style_bg_opa(hTestWin, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_obj_set_style_bg_color(hTestWin, lv_color_hex(0x000000), 
	lv_obj_add_event_cb(hTestWin, Key_event_cb, LV_EVENT_KEY, NULL);
	lv_group_add_obj(lv_group_get_default(), hTestWin); 
	lv_group_set_editing(lv_group_get_default(), true);

## Screenshot and/or video
If possible, add screenshots and/or videos about the current state.