View which screen is on

Description

There are functions that should work on one screen, while the same function is not needed on another, I think that you need to check “which screen works”

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

ESP32

What do you want to achieve?

What have you tried so far?

lv_disp_get_scr_act(lv_disp_t disp) I think this function can help, but I don’t quite understand how to use it.

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*/

Screenshot and/or video

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

Please translate the title to English.

You can use lv_scr_act(). E.g.

scr1 = lv_obj_create(NULL, NULL);
scr2 = lv_obj_create(NULL, NULL);

...

/*In the function*/
if(lv_scr_act() == scr1) /*Do somethings*/
else /*Do something else*/
1 Like