Hi all - I’ve seen some examples that call
lv_obj_invalidate(obj) after making a ‘change’ via some other lv_* API and I’ve seen plenty which don’t seem to do that. So I’m looking to gain some clarity on when it’s needed versus not.
I do see this reference specifically about making style changes needing to be followed by invalidating objects to “let them know” the style was modified. So, I think I can follow that rule. But when else should it be used? I feel like I’m starting to use it out of paranoia and that’s likely poor form and poor for performance.
Asynchronous style changes is the case when you need manual invalidation or chage “report”. If you you do something with an object, LVGL know that the object needs to invalidated. That is all functions where
lv_obj_t* is the first parameter will invalidate the given object automatically.
However if you change a style somewhere, you need to notify the widgets manually. Else LVGL won’t know about the style change.
Probably your UI code can be organized a little bit differently. In the practice I need to call the manual invalidation functions about once a year If a style is related to a given object you can use a local style too.
Super information and clarity. Thank you. This is exactly what I was hoping to learn. I’ll take a look at local styles too, but now I get the appropriate use case here around styles.