lv_tabview: add lv_res_t return value to prevent tab laoding on LV_RES_INV

This commit is contained in:
Gabor Kiss-Vamosi
2018-10-28 10:29:06 +01:00
parent 4f11ad7adb
commit fc319a4502
2 changed files with 6 additions and 3 deletions
+3 -1
View File
@@ -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;
+3 -2
View File
@@ -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 {