Lv_obj_add_flag compiles OK but lv_obj_update_flag throws a compilation error 8.3.10

Hello, I am trying to hide a spinner when my bool is_turning is false. This is my code:

  lv_obj_add_flag(ui_TurningSpinner, LV_OBJ_FLAG_HIDDEN);
    lv_obj_update_flag(ui_TurningSpinner, LV_OBJ_FLAG_HIDDEN, true);
  } else {
    lv_obj_update_flag(ui_TurningSpinner, LV_OBJ_FLAG_HIDDEN, false);
  }

This bit works - it compiles and it hides the spinner:
lv_obj_add_flag(ui_TurningSpinner, LV_OBJ_FLAG_HIDDEN);

This bit gives a compilation error:
lv_obj_update_flag(ui_TurningSpinner, LV_OBJ_FLAG_HIDDEN,false);

Compilation error: ‘lv_obj_update_flag’ was not declared in this scope

I tried using lv_obj_clear_flag but that didn’t seem to work - i.e. the spinner did not un-hide.
I had a good read through lv_conf.h to see if object flags were switched off by default but couldn’t see anything there.

I’m compiling on a Mac and using SquareLine Studio for generating the ui. I’m then adding a bit more code in Arduino IDE 2 before uploading to my controller.

Anyone got any ideas how to fix this please?

ok this is happening with a lot more than just the above
lv_checkbox_set_checked also throws a compilation error
could this be something to do with memory allocation?

Things that do compile:
lv_label_set_text_fmt
lv_obj_add_flag
lv_arc_get_value

Things that do not compile (all with the same error):
lv_checkbox_set_checked
lv_obj_remove_flag
lv_obj_update_flag

ugh sorry - just been told those functions are not in 8.3.X

How was this resolved? I have the same problem.

Hello, yes, it’s the version of LVGL that causes this. If you’re on Arduino like me then you’ve got 8.3 so you need to use compatible commands with 8.3 - such as:

lv_obj_clear_flag(ui_tempNow, LV_OBJ_FLAG_HIDDEN); // this makes object ui_tempNow visible
lv_obj_add_flag(ui_TurningSpinner, LV_OBJ_FLAG_HIDDEN); // this hides object ui_TurningSpinner

It’s worth noting that SquareLine Studio adds ui_ to the object names that you define when creating your UI, so accessing those objects directly in your code needs to take that into consideration as in the two examples above.

1 Like

It’s Solved,

Thanks!!!

Exactly these commands. They work perfectly.

Thank you very much

You’re welcome. Are you on Arduino IDE?

yes, I’m using the Arduino IDE, Squareline Studio and LVGL.

Look how my project is turning out:

and:

OK that is looking very nice! What hardware you using? I’m using Arduino Giga with Giga Display - I have a lot of stuff to attach. Looking like this:

I have several projects with LVGL and hardware based on ESP32+TFT.

This particular hardware is the 2.4" Sunton.

The interface you created is very beautiful. Congratulations.

I put the link to the store on Aliexpress below for you.

If you are interested. I liked their display. It just doesn’t have many I/O pins, but for my application in particular it served well.

https://pt.aliexpress.com/store/1100192306?spm=a2g0o.detail.1000061.1.703b2WNF2WNFDP

ah - thank you that is very interesting - I shall investigate and maybe get one…