Newbie here and love the library. I just started using it and it has really spiced up my project.
I using it on an ESP32 with a 3.5 TFT and it is working great.
I’m using the tabview and adding buttons to the first tab. But I have noticed that when trying to press a button I can move the buttons. This is probably a nice feature to be able to scroll the tabview. I have been able to turn off the scroll bars. but that does not disable the scrolling.
I have noticed that dragging the page left or right will move between tabs. this might be what needs to turned off too.
I would like to disable the scrolling or the dragging on this one tab page or all tab pages.
which ever is moving the buttons. Can this be done?
You can disable manual sliding between the tabs using lv_tabview_set_sliding(tabview, false). I don’t know if this disables the ability to scroll the tabs if you have too many to fit on the screen and I don’t have the time to check this afternoon, but hopefully this gets you headed in the right direction!
Thanks for the quick reply. the lv_tabview_set_sliding(tabview, false) command worked for stopping the dragging across tabs.
But it did not resolve my issue the buttons were still moving around the screen when I dragged my finger on the screen. What I found was the when I added a button and set the position to 0,0 it added some length to the page height and width. This then allow me to drag the button around just a little.
To resolve this I offset the buttons by 5,5 and that stopped the expanding of the page. Not sure if this is a feature or a bug.
I also found this happens with a label to at offset 0,0.
Here is the code.
lv_obj_t *tabview;
tabview = lv_tabview_create(lv_scr_act(), NULL);
// Add tab
lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Thermostat");
// add button
lv_obj_t *btnOFF = lv_btn_create(tab1, NULL);
lv_obj_set_size(btnOFF, 70, 100); //set the button size
// This is the line that fixed it change the 5,5 to 0,0 and you will be able to move the button
lv_obj_align(btnOFF, NULL, LV_ALIGN_IN_TOP_LEFT, 5, 5); //set the position to top left
When I was reading thought the code I also found this. I’m not sure if it is a bug or what. Someone may want to look at it.
In function
static void tabpage_pressing_handler(lv_obj_t * tabview, lv_obj_t * tabpage)
} else if(ext->drag_hor == 0) {
ext->drag_hor = 0; <---- HERE if 0 set to 0???
}
lv_obj_t *tabview;
tabview = lv_tabview_create(lv_scr_act(), NULL);
// Add tab
lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Thermostat");
// add button
lv_obj_t *btnOFF = lv_btn_create(tab1, NULL);
lv_obj_set_size(btnOFF, 70, 100); //set the button size
// This is the line that fixed it change the 5,5 to 0,0 and you will be able to move the button
lv_obj_align(btnOFF, NULL, LV_ALIGN_IN_TOP_LEFT, 5, 5); //
lv_tabview_set_sliding(tabview, false);
Just to be sure we are talking about the same issue can you send a video?
Ah sorry, got it now.
It happens because if you position something close to the edge of a page and it has fit enabled then the page will be resized to keep padding space. To solve it you can do 2 things:
Keep at least style.body.padding.left/top/right/bottom space. To get the style: style = lv_page_get_style(tab1, LV_PAGE_STYLE_SCRL)
Set a different fit mode for the tab page. E.g. lv_page_set_scrl_fit(tab1, LV_FIT_FLOOD);
Note that only those object’s have fit feature which are derived from lv_cont. (e.g. button or page)