[v7.0] Disable tab_view sliding

Description

In 6.2 Tabview had an option to disable sliding (lv_tabview_set_sliding), I can’t find it in 7.0 or any way in the documentation to turn this off.

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

I’m using the simulator.

What do you want to achieve?

Disable Tabview Sliding, only changing tabs by clicking the buttons

What have you tried so far?

I’ve read the documentation and looked through the lv_tabview.c file.

Hi @BFFonseca,

I would try setting the drag parameter to FALSE for the Tabview with the function:

void lv_obj_set_drag(lv_obj_t * obj, bool en); 

I haven’t tried this myself, not anywhere I can try it right now…

Hope that helps,

Kind Regards,

Pete

I tried applying this to the tabview as well as the tabs themselves.

It didn’t seem to work. I’ll look into the lv_obj functions.

It doesn’t seem that there’s a dedicated API for this anymore, but this hack might work (untested):

lv_obj_set_drag_throw(lv_page_get_scrllable(((lv_tabview_ext_t *)lv_obj_get_ext_attr(tabview))->content), false);

You can apply lv_page_set_scroll_propagation(tab1,false);.
See here: https://docs.lvgl.io/v7/en/html/widgets/tabview.html#scroll-propagation

lv_page_set_scroll_propagation(tab1,false) worked perfectly. I thought I had tried it before without success.

Thank you.

1 Like