How to get the EDGE_EVENT of the page


I want to know if the page produces an event when it scrolls to the edge. I can’t find a description for this event in the documentation, but here’s another API:lv_page_set_edge_flash();So I think there should be an event like that.

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


What LVGL version are you using?


What do you want to achieve?

I want to do something automatically when the page scrolls to the edge

@kisvegabor It looks like the page object is gone in v8 as the scrolling features were merged into lv_obj directly. Do you think it’s worth adding an event to v7 for this only to reimplement it for v8?

@juneofive As a workaround for v7, you should be able to register a custom signal handler on lv_page_get_scrollable(page):

static lv_signal_cb_t old_page_scrollable_signal;
static lv_res_t custom_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
    lv_res_t res;

    /* Include the ancient signal function */
    res = old_page_scrollable_signal(scrl, sign, param);

    if(res != LV_RES_OK) return res;

    lv_obj_t * page               = lv_obj_get_parent(scrl);

    if(sign == LV_SIGNAL_COORD_CHG) {
        if(lv_page_on_edge(page, LV_EDGE_xxx)) {
            /* do what you want */
    return res;
old_page_scrollable_signal = lv_obj_get_signal_cb(lv_page_get_scrollable(page));
lv_obj_set_signal_cb(lv_page_get_scrollable(page), custom_page_scrollable_signal);

I’d recommend the custom signal callback as @embeddedt suggested. The scrolling in v7 is quite complex and I wouldn’t complicate it further. :slight_smile:

Actually, there is no direct event for it in v8 either but there is (will be) an LV_EVENT_SCROLL event where the scroll position can be tested.

Once we are talking about it, here is how a list looks like in v8 now:
Peek 2021-02-04 14-25

Is edge flash gone from v8?

Yes, instead I choose to more modern and faster “elastic scroll”. Do you think the edge flash is also important? I haven’t seen it for a while on mobile and web.

I think it’s fine to use elastic scroll. I’m pretty sure Android still has the edge flash but elasticity is close enough and faster like you said.

thanks for you answer,but i havent clear where to registed the custom singal fuction. i have tryed to add this part after created page

old_page_scrollable_signal = lv_obj_get_signal_cb(lv_page_get_scrollable(page));
lv_obj_set_signal_cb(lv_page_get_scrollable(page), custom_page_scrollable_signal);

but the program run to Hard Fault

I think Maybe the description of my problem is not clear enough. In my project, the LABEL was created on the PAGE to display a TEXT, and the scroll of the PAGE was controlled by the button without using LV_INDEV. I hope to change the TEXT on the LABEL when scrolling to the top and bottom.It is similar to a drop-down refresh page on a mobile phone APP.

Then it’s much simpler. Just use if(lv_page_on_edge(page, LV_EDGE_xxx)) when you moved the page manually.

thanks,That’s what I need