With a tabview with 2 tabs and setting the first tabs buttons width to twice that of the second button the indicator below the button is not sized correctly.
What do you expect?
The indicator below the buttons to sized correctly with the buttons.
Code to reproduce
tabviewOnOff = lv_tabview_create(lv_scr_act(), NULL);
// Add 2 tabs (the tabs are page (lv_page) and can be scrolled
tabThermostatOn = lv_tabview_add_tab(tabviewOnOff, "On");
tabThermostatOff = lv_tabview_add_tab(tabviewOnOff, "Off");
lv_tabview_set_tab_act(tabviewOnOff, 1, LV_ANIM_OFF);
// set one button to twice the rest
lv_tabview_ext_t * ext = (lv_tabview_ext_t *)lv_obj_get_ext_attr(tabviewOnOff);
lv_btnm_set_btn_width(ext->btns, 0, 4);
This is not really a bug, as accessing the ext_attr structure of objects directly is not officially supported. It can lead to issues like this, as the underlying implementation is not expecting you to change properties like that.
In your case, the problem is that the tabview is not using button widths to determine the width of the indicator, because it assumes that all the buttons are the same width. Do you think it’s worthwhile adding this feature to 7.0?
The tabview supposes that the tab buttons have the same width.
As this way of usage is really not supported I think it’s not worth to fix it.
Anyway, it’s an interesting idea to make possible to set different width for the tab buttons. If you are interested, you can open topic for it in the Feature request category.
Thanks I will do that. In the mean time can you point me in a direction to fix this myself? I see in the tabview.c code where it is calculating the indicator size. But I think this should be changed in lv_tabview_set_tab_act to get the selected button width or height depending on the button placement. Where is the button width? Has it already been calculated?
Sorry I’m using lvgl/Arduino branch. Pablo just merge the 6.1 code into that branch. Is there a way to automate the lvgl/Arduino branch so that Pablo doesn’t have to manually merge the code?
I will look into changes for the existing 6.1 Arduino branch. I don’t think it will be that hard. I will also need to get the x offset or y offset for the buttons.
He did? It seems that the last change to master was made at the end of September.
The tabview code has changed somewhat since 6.1. It would simply the workload if you made the change against 7.0, rather than us having to manually port it from a 6.1 codebase.
I agree changing 7.0 would be easier. But I have no way to test it. Unless… I get the simulator running. I tried to get the simulator running once on windows without success. Do you have setup information for platformio and visual studio code?
I’m running windows. the instructions are for Linux. I installed MinGW. But when I try to build I get these errors.
Verbose mode can be enabled via -v, --verbose option
PACKAGES:
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies…
Dependency Graph
|-- 6.1.1
|-- <lv_drivers> 6.0.2
| |-- 6.1.1
Building in release mode
Compiling .pio\build\native\drivers\sdl2\driver.o
Compiling .pio\build\native\src\demo.o
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\native\src\img_bubble_pattern.o
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\native\src\main.o
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\native\src\syscalls.o
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_debug.o
Compiling .pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_disp.o
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_group.o
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_indev.o
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_obj.o
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
Compiling .pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_refr.o
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
*** [.pio\build\native\drivers\sdl2\driver.o] Error 1
Compiling .pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_style.o
*** [.pio\build\native\src\demo.o] Error 1
*** [.pio\build\native\src\img_bubble_pattern.o] Error 1
*** [.pio\build\native\src\main.o] Error 1
*** [.pio\build\native\src\syscalls.o] Error 1
*** [.pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_debug.o] Error 1
*** [.pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_disp.o] Error 1
*** [.pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_group.o] Error 1
*** [.pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_indev.o] Error 1
*** [.pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_obj.o] Error 1
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
*** [.pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_refr.o] Error 1
‘gcc’ is not recognized as an internal or external command,
operable program or batch file.
*** [.pio\build\native\lib6b3\lvgl_ID6598\lv_core\lv_style.o] Error 1
============================================================ [FAILED] Took 1.56 seconds ============================================================
I have a suggestion, why not move the indicator into the button matrix. That way the indicator could be used with the button matrix to show the selected button. I think it would make it more useful and add more visual indicator for the selected button.
You are right it would look ugly. I would not change the look of anything already in lvgl. by default the indicator and indicator animation would be off and only turned on for tabview. But it someone wanted to use in the indicator and/or the animation of the indicator with the button matrix then it would be available. Right now it is only available in the tabview. I think it would be the same amount of code in the button matrix but usable by other components then just the tabview. I would also allow the indicator on any side of the button matrix. Just my 2 cents.