Disabling tabview buttons


I want to know how to disable/reenable tabview buttons so I can prevent users from using them until the app is ready for those buttons to be used.

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

STM32F407VET6 “black” board

What do you want to achieve?

Disable and enable tabview buttons so I can restrict their use. I want to make the user go through the screens in order the first time but then allow them to go back and forth - it is a nested tree of selections, so to speak.

What have you tried so far?

I found some code at https://github.com/littlevgl/lvgl/issues/439 but even after correcting for the issues I could not make it compile (the LV_BTNM_INACTIVE_MASK was not found).

Next, I tried using lv_btnm_set_btn_ctrl to set the button control mask to LV_BTNM_CTRL_INACTIVE. It made the button LOOK inactive, but it still worked and switched to the tab.

Code to reproduce

No code - that’s the problem. I can’t make it work

lv_obj_set_click(btn1, false);

I would say that it’s a bug in the library. Your solution with LV_BTNM_CTRL_INACTIVE was technically correct, but the tabview does not check whether a button is inactive before using it.

I’ve submitted a PR that should fix it: https://github.com/littlevgl/lvgl/pull/1459

Can you try the tabview_inactive branch or apply the fix manually?

That works for buttons, but I don’t know how to get the button from the tabview. This is the button that is used to move to the tab.

My PR is merged. If you pull master using lv_btnm_set_btn_ctrl should work now.

OK - I tried your code and it still won’t work.
I’ve been using Lvgl 6.0, and apparently there were some significant changes to some data structures with 6.1 because when I switched to 6.1 (by pulling the current master) it broke my touchscreen driver.

I tried adding the one line you changed in the tabview.c file to the appropriate place in my copy of tabview.c and it worked perfectly!

I’ll have to work with the guy who ported lvgl over to the STM32F407VET6 black board to see if he can update to 6.1, but at least I’m back on target for my project.

Thank you very much for your help!