mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-07 02:32:44 +08:00
lv_tabview: add lv_res_t return value to prevent tab laoding on LV_RES_INV
This commit is contained in:
@@ -275,8 +275,10 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
|
||||
|
||||
lv_style_t * style = lv_obj_get_style(ext->content);
|
||||
|
||||
lv_res_t res = LV_RES_OK;
|
||||
if(id >= ext->tab_cnt) id = ext->tab_cnt - 1;
|
||||
if(ext->tab_load_action && id != ext->tab_cur) ext->tab_load_action(tabview, id);
|
||||
if(ext->tab_load_action && id != ext->tab_cur) res = ext->tab_load_action(tabview, id);
|
||||
if(res != LV_RES_OK) return; /*Prevent the tab loading*/
|
||||
|
||||
ext->tab_cur = id;
|
||||
|
||||
|
||||
@@ -42,8 +42,9 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/* parametes: pointer to a tabview object, tab_id*/
|
||||
typedef void (*lv_tabview_action_t)(lv_obj_t *, uint16_t);
|
||||
/* parametes: pointer to a tabview object, tab_id
|
||||
* return: LV_RES_INV: to prevent the loading of the tab; LV_RES_OK: if everything is fine*/
|
||||
typedef lv_res_t (*lv_tabview_action_t)(lv_obj_t *, uint16_t);
|
||||
|
||||
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user