Follow the drag

Description

What MCU/Processor/Board and compiler are you using?

PC

What LVGL version are you using?

7.0

What do you want to achieve?

When I use alignment, I want to drag one control. How do I get the other control to follow

What have you tried so far?

Code to reproduce

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

I believe you can hook into LV_EVENT_PRESSING on the first control and then reposition the second control inside that event.

ok thanks .
What is lv_obj_set_auto_realign used for?Can I do that with this?

It’s used to automatically call lv_obj_align again whenever the object’s size changes (useful for animations, etc.). See the documentation.

You are changing positions, not sizes, so you would need to do the realigning yourself.