Reposition of items and relative aligned ones


I want to create my object and then move them to the proper location.
Like i will have program functions that will create objects like buttons, which functions will be called from one main interface setup function.
In this case labels that are aligned to inputs should be move with the input when the second is repositioned.
Cause on initial creation of textarea you do not know the final position the textarea is at (X,Y)=(0,0) then the label is align to this outside of the screen cause the location is ALIGN_OUT_TOP. After repositioning the textarea the label does not follow even with lv_obj_invalidate(label) function.

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


What LVGL version are you using?

8.3 simulator

What do you want to achieve?

I want to be able to reposition items that are aligned in relationship with other items by repositioning the second ones.

What have you tried so far?

Have a function that creates label and place it above a textarea. This function is called and then i try to reallocate the textarea expecting label to be realocated by using the invalidate function but it does not work or the lv_obj_refr_pos

Code to reproduce

The code block(s) should be formatted like:

typedef struct{
	lv_obj_t * ta;
	lv_obj_t * kb;
	lv_obj_t * lb;

typedef struct{
	int32_t width;
	int32_t height;
	int32_t maxChars;
	char* labelText;
	char* placeholder;
	bool pwdFlag;
	bool oneLineFlag;

void main_view(){

	textarea_t taConf={
			.labelText="The label Text",
			.placeholder="The placeholder",

	input_keyboard_obj tkl=create_text_area(taConf, LV_KEYBOARD_MODE_TEXT_UPPER);
	lv_obj_set_pos(tkl.ta, 100, 70);

input_keyboard_obj create_text_area(textarea_t taConf,lv_keyboard_mode_t kb_mode){

	lv_obj_t *ta = lv_textarea_create(lv_scr_act());
	lv_obj_set_size(ta, taConf.width, taConf.height);
	lv_textarea_set_placeholder_text(ta, taConf.placeholder);
	lv_textarea_set_password_mode(ta, taConf.pwdFlag);
	lv_textarea_set_one_line(ta, taConf.oneLineFlag);
	lv_textarea_set_max_length(ta, taConf.maxChars);

	lv_obj_t *lb = lv_label_create(lv_scr_act());
	lv_label_set_text(lb, taConf.labelText);
//	lv_obj_set_style_bg_color(lb, lv_palette_main(LV_PALETTE_YELLOW), LV_PART_MAIN | LV_STATE_DEFAULT);
	lv_obj_align_to(lb, ta, LV_ALIGN_OUT_TOP_LEFT, 0,0);

	lv_obj_t *kb = create_keyboard(LV_KEYBOARD_MODE_TEXT_UPPER, ta);
	lv_obj_add_event_cb(ta, textarea_event_handler, LV_EVENT_FOCUSED, kb);
	lv_obj_add_event_cb(ta, textarea_event_handler, LV_EVENT_DEFOCUSED, kb);

	input_keyboard_obj obj={
	return obj;

lv_obj_t * create_keyboard(lv_keyboard_mode_t kb_mode, lv_obj_t* textarea){

	lv_obj_t *kb=lv_keyboard_create(lv_scr_act());
	lv_keyboard_set_mode(kb, kb_mode);
	lv_keyboard_set_textarea(kb, textarea);
	return kb;


Screenshot and/or video

Base on documentation :

Note that, unlike with lv_obj_align() , lv_obj_align_to() can not realign the object if its coordinates or the reference object’s coordinates change.

so what is the proper solution. Do i have to create function that sets position for both objects (label,input) as a wrapper?