Code
The code block(s) should be between ```c
and ```
tags:
static lv_obj_t * obj;
static lv_obj_t * obj5;
void lv_ex_get_started_1(int en)
{
if (en == 1) {
static lv_style_t style;
lv_style_init(&style);
obj = lv_img_create(lv_scr_act(), NULL);
lv_obj_add_style(obj, LV_IMG_PART_MAIN, &style);
lv_img_set_src(obj,&cec_charing_5);
lv_obj_set_pos(obj, 200,10);
static lv_style_t style5;
lv_style_init(&style5);
obj5 = lv_img_create(lv_scr_act(), obj);
lv_obj_add_style(obj5, LV_IMG_PART_MAIN, &style5);
lv_img_set_src(obj5,&cec_video_instruct);
lv_obj_set_pos(obj5, 78,10);
}else if (en == 0) {
lv_obj_del(obj5);
} else {
//do nothing
}
Here is my sample code. I can draw the two images(cec_charing_5 & cec_video_instruct) on screen when the “en” is 1, but when I set “en = 0” to call lv_obj_del(obj5) to delete “obj5”, the another obj will also disappear.
I also try to use lv_obj_set_pos() to move obj5 to another position. All the objs are disappeared on screen. It seems I cannot do any operation for any one of two objs. Once I did it , all the objs will disappear. Does anything I miss in the code?
I’m using V7.10.1 and runs on RTOS.
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.