V8.0 Disable tabview sliding

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Read the

Delete this section if you read and applied the mentioned points.

Description

In 6.2 Tabview had an option to disable sliding (lv_tabview_set_sliding), I can’t find it in 8.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 have tried lv_obj_set_scrollbar_mode(main_tabview, LV_SCROLLBAR_MODE_OFF);

Code to reproduce

Add the relevant code snippets here.

The code block(s) should be between ```c and ``` tags:

/*You code here*/
main_tabview = lv_tabview_create(lv_scr_act(), LV_DIR_TOP, 20);
    lv_obj_set_size(main_tabview, 320, 146);
    lv_obj_set_pos(main_tabview, 0, 24);
    lv_obj_add_flag(lv_tabview_get_tab_btns(main_tabview), LV_OBJ_FLAG_HIDDEN);
	lv_obj_add_style(main_tabview, &cont_style, 0);
	lv_obj_set_scrollbar_mode(main_tabview, LV_SCROLLBAR_MODE_OFF);

    for (i = 0; i < MAX_WIN_ID; i++)
	{
		tab_win[i] = lv_tabview_add_tab(main_tabview, tab_name[i]);
		lv_obj_set_scrollbar_mode(tab_win[i], LV_SCROLLBAR_MODE_OFF);
		tab_win_create[i](tab_win[i]);
        lv_obj_add_style(tab_win[i], &pad_style, 0);
	} 

Screenshot and/or video

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

do this:

lv_obj_clear_flag(t1, LV_OBJ_FLAG_SCROLLABLE);

Thank you very much, it has been solved.

One more question, I want to set a button and a list in a tab, I just want the list to slide, but the problem I’m currently having is but when I slide the list, the button will slide with it, how should I fix this problem? Thanks!

I tried using lv_obj_clear_flag in version 8.2 in order to prevent tabview slider.
It did not work. Any other ideas?

Mine v8.3 clear all related flag but no luck the TabView still slidable.

lv_obj_clear_flag( ui_TabView1, LV_OBJ_FLAG_CLICK_FOCUSABLE | LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_ELASTIC | LV_OBJ_FLAG_SCROLL_MOMENTUM | LV_OBJ_FLAG_SCROLL_CHAIN );    /// Flags

Version 8.3.6 not working either. Any suggestion?

Found a solution in example lv_example_anim.c:

lv_obj_clear_flag(lv_tabview_get_content(mainTabSet), LV_OBJ_FLAG_SCROLLABLE);

This did it for me :slight_smile:

@Ernst GREATTTT!!! Thanks alot, this solved it for me too! :partying_face:

1 Like

OK, now we should know that the TabView having its own container child inside, that need to be set flag manually to LV_OBJ_FLAG_SCROLLABLE, not the TabView itself.

I am curious about what more this container can do. I didn’t see anything of this in the manual. LVGL biggest hurdle is, for me, the documentation. However, I like the library a lot.

Hello, if I recall correctly “container” is a name used in Squareline Studio (LVGL editor) and it is basically just an empty base object in which child objects can be placed.

In LVGL, a container would simply be made by creating a base object type: Base object (lv_obj) — LVGL documentation

Visually speaking, this creates a sort of container or panel in which other objects (widgets, etc.) can be placed by making them children of this “container” object.

Anyway, as I mentioned the Tabview having its own container child inside, that need to apply it own LV_OBJ_FLAG_SCROLLABLE flag, if you Ernst want to know how this “container” can do, please look at the structure mentioned on top of the documentation:
https://docs.lvgl.io/8.3/widgets/extra/tabview.html?highlight=tabview

Tabview (lv_tabview)

Overview

The Tab view object can be used to organize content in tabs. The Tab view is built from other widgets:

Thank you for the link to the documentation @tpt.
Of course I’ve read this carefully. It is for a new LVGL user very difficult to discover what part of the tabView constellation is responsible for the scrolling. The flag LV_OBJ_FLAG_SCROLLABLE cannot be found on this page. This leads to uncertainties, are there any other flags introducing unexpected behaviour?