When the current tab page is editing the content of the control, how to prohibit tabview from switching to other tab pages?
What MCU/Processor/Board and compiler are you using?
What LVGL version are you using?
What do you want to achieve?
Can enable or disable tab page switching
What have you tried so far?
1、I tried to disable ext->btns , but I can’t see the color change in the disabled state in the UI .
2、And, Tabs can still be switched by dragging left and right.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/*You code here*/
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.
@embeddedt Can you give me some good ideas?
Unless I’m forgetting something, I don’t think there is a built-in way to disable a tabview. My suggested workaround would be a popup dialog with the control you are editing.
In v8 the disabled state will propagate to child objects, so I think implementing this will be much simpler.
Really there is no built-in way to do it but this should do the job:
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
@embeddedt How to set the color when tabview is disabled?
I added this in tabview_init, but it doesn’t work。
lv_style_set_bg_color(&styles->tabview_btns, LV_STATE_DISABLED, LV_COLOR_RED);
The disabled state doesn’t propagate down to the buttons so using
LV_STATE_DISABLED on the style won’t work. I think you would have to change the color manually - probably with a local style.