Basically is this the relevant code, I’ve a definition of the object that I’ll hide (it’s a little button bar with options)
buttonBar = lv_obj_create(mainScreen);
lv_obj_remove_style_all(buttonBar);
lv_obj_set_flex_flow(buttonBar, LV_FLEX_FLOW_ROW);
lv_obj_set_flex_align(buttonBar, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
lv_obj_add_flag(buttonBar, LV_OBJ_FLAG_FLOATING);
lv_obj_set_style_radius(buttonBar, LV_RADIUS_CIRCLE, 0);
lv_obj_set_style_border_color(buttonBar, lv_color_white(), 0);
lv_obj_set_style_border_width(buttonBar, 1, 0);
lv_obj_set_style_border_opa(buttonBar,LV_OPA_20,0);
lv_obj_set_style_bg_color(buttonBar, lv_color_black(), 0);
lv_obj_set_style_bg_opa(buttonBar, 250, 0);
lv_obj_add_flag(buttonBar, LV_OBJ_FLAG_FLOATING);
lv_obj_set_size(buttonBar, 50 * scaleBut, 50 * scaleBut);
lv_obj_align(buttonBar, LV_ALIGN_BOTTOM_RIGHT, 0, -LV_DPX(14) );
In the main screen I’ve an event that get the active tile (the active tile is another object of the main screen)
lv_obj_add_event_cb(tilesScreen, getActTile, LV_EVENT_SCROLL_END, NULL);
lv_obj_t *actTile = lv_tileview_get_tile_act(tilesScreen);
lv_coord_t tileX = lv_obj_get_x(actTile) / TFT_WIDTH;
activeTile = tileX;
activeTile is a enum structure with the name of the active Tile
Later I check the active tile if it’s one I need to hide the button bar
if (activeTile == MAP)
lv_obj_add_flag(buttonBar,LV_OBJ_FLAG_HIDDEN);
else
lv_obj_clear_flag(buttonBar,LV_OBJ_FLAG_HIDDEN);
All this it’s when tile scroll is finished , of course.
When finish scroll to the tile raise this error
[Error] (14.915, +14915) lv_obj_add_flag: Asserted at expression: obj != NULL (The object is NULL) lv_obj.c:116
all objects, buttonBar, tileScreen, and mainScreen are globals variables