I just updated a project from LVGL 7.10.1 to latest release, 8.0.2.
Everything is fine except that the lv_obj_set_auto_realign function doesn’t exist anymore.
Is there a new function to achieve the same behavior or the new layout system is not compatible ?
For layout, I only changed the old lv_obj_align to its new counterpart and lv_obj_align_to when relevant.

1 Like

hello Patrick, I have the same problem. I searched in the LVGL documents and found nothing.
if you find how to solve this problem, please share your answer

I don’t have any solution.
I am now using the grid layout and I don’t need lv_obj_align_to anymore.
I achieve alignment with cells.

Thanks for your help.

Dear @kisvegabor ,

any API for the asked feature, in v8? Please let us know.

In v8, all alignments are saved and reapplied automatically if needed. So auto_realign = true is the default.

However, it’s no the case with lv_obj_align_to(). Here you need to apply the alignment again manually if required.

It’s just a personal experience, but basically I never use lv_obj_align_to. If an object needs to be aligned to a sibling or more or less unrelated object, probably a layout (flex or grid) is a better option.

Have to chime in, but I personally feel that layouts are overkill in cases where you just want, say, two labels to align next to each other, and the content of one label changes. I do miss this from v7; obviously, this is solved by having the align code follow any code to set the labels text, but I preferred the method in v7.

To bring lv_obj_align_to(obj, base, ...) to a next level we need to store all obj - base connections so that either obj or base changes we can reapply the align.

Note that in v7, only base were stored in obj. Therefore if base changed obj wasn’t updated.

I have an idea how to handle this events and event user data. This way it can be an option module that can be enabled in lv_conf.h. If it were add we should deprecate the lv_obj_align_to() function.