Dragging page similar to the way a list can be dragged

Hello,

I open a new thread, since the Previous thread no longer matches the subject of the thread.

On a list object, it is possible to activate dragging by touch-and-hold a button for about half a second. After that, the touch is no longer interpreted as a “click” onto the button, but the whole list container is dragged.

I’d like to implement the same behavior for a page object that is filled up with buttons. So I configure the buttons like this:

    lv_obj_t *b = lv_btn_create (page, NULL);
    lv_obj_set_drag (b, 1);
    lv_obj_set_drag_parent (b, 1);
    lv_obj_set_drag_dir (b, LV_DRAG_DIR_VER);

But this won’t drag the page. Instead, the “clicked” indication moves from one button to the next when a button is dragged.

Unfortunately, I can’t find examples or explanations about how the drag feature is meant to work.

What am I missing here?

@kisvegabor Is it possible to make this work in v7 or does it require the v8 scrolling improvements? If I recall correctly, scroll propagation only works on page-based widgets in v7, not buttons.

1 Like

Could it be that gluing buttons to the page might help?

lv_page_glue_obj(b, true);

Or is this some v8 -specific stuff (of which I know nothing about…)

1 Like

Yes, lv_page_glue_obj() can be used.

To keep the the “press” on the button use lv_obj_add_protect(b, LV_PROTECT_PRESS_LOST);

1 Like

Thanks, works now!

1 Like