How to use lv_page_glue_obj on tabview

Description

lv_page_glue_obj do not work on tabview

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

esp32

What do you want to achieve?

lv_page_glue_obj work on tabview

What have you tried so far?

Code to reproduce

/*You code here*/

Screenshot and/or video

Please fill the “Code to reproduce” section.

I’m very sorry, I don’t think there is any need for code for this problem. The code doesn’t explain anything. The problem is that: in tileview, the widget can use lv_tileview_add_element to make the mobile widget move the tileview. The movement is passed to the parents.But I tried using lv_page_glue_obj on tabview, but had no effect.

It actually does. :slightly_smiling_face: It’s usually much easier for us to understand the problem when we can see and interact with the code and the result on the display, compared to a description.

code show as below,Can you help me:smiley:
lv_obj_t *tabview = lv_tabview_create(lv_scr_act(), NULL);
lv_obj_t *tab_1 = lv_tabview_add_tab(tabview, "1");
lv_obj_t *tab_2 = lv_tabview_add_tab(tabview, "2");

lv_obj_t *btn = lv_btn_create(tab_1, NULL);
lv_obj_align(btn, tab_1, LV_ALIGN_CENTER, 0, 0);
lv_page_glue_obj(btn, true);

Even this code snippet was useful to be sure we are talking about the same thing.

In the current version, lv_page_glue_obj propagates the drag on the to page. So it makes possible to scroll the page with the button. See:
tv

    lv_obj_t *tabview = lv_tabview_create(lv_scr_act(), NULL);
    lv_obj_t *tab_1 = lv_tabview_add_tab(tabview, "1");
    lv_obj_t *tab_2 = lv_tabview_add_tab(tabview, "2");

    lv_obj_t *label = lv_label_create(tab_1, NULL);
    lv_label_set_text(label, "asd very very very very very very very very long line line line line line\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd\nasd");
    lv_obj_t *btn = lv_btn_create(tab_1, NULL);
    lv_obj_align(btn, tab_1, LV_ALIGN_CENTER, 0, 0);
    lv_page_glue_obj(btn, true);

Note that, in the next version (v7.0), the feature you mentioned already exists.
Bit it will be released only in a few months… :frowning:

I think you understand it wrong, I dragged btn to move from tab1 to tab2, there is no movement inside tab1, and I set none_fit

You can’t use the button to move between tabs in v6.1 (it only works to scroll the page up and down). In dev-7.0, as @kisvegabor mentioned, you can use the button to move between tabs.

I see, thanks, I am looking forward to 7.0

1 Like