When a new TextArea is created by copying from the old new
lv_obj_t new_ta = lv_ta_create(lv_scr_act(), old_ta);
The new one has the same with the old one’s placeholder too.
When a new TextArea is created by copying from the old new
lv_obj_t new_ta = lv_ta_create(lv_scr_act(), old_ta);
The new one has the same with the old one’s placeholder too.
I quickly added a trivial implementation of this feature to the ta_placeholder_copy
branch. Can you test it? If it works it can be merged into dev-6.1
.
It should be reposition between these lines ?
From
if(copy_ext->one_line) lv_ta_set_one_line(new_ta, true);
if(copy_ext->placeholder != NULL)
ext->placeholder = lv_label_create(new_ta, copy_ext->placeholder);
else
ext->placeholder = NULL;
To
if(copy_ext->placeholder != NULL)
ext->placeholder = lv_label_create(new_ta, copy_ext->placeholder);
else
ext->placeholder = NULL;
if(copy_ext->one_line) lv_ta_set_one_line(new_ta, true);
Because of “lv_ta_set_one_line” should be effect to the not-null placeholder too?
Updated.
10 chars.
Thank you for very quickly update. : )
Another issue,
when I created password_ta as a password-mode TextArea.
And I copied the old password_ta to the new one (password_ta2)
as the following code :
lv_obj_t *password_ta = lv_ta_create(lv_scr_act(), NULL);
lv_ta_set_pwd_mode(password_ta, true);
lv_ta_set_text(password_ta, "1234567890");
lv_ta_set_placeholder_text(password_ta, "Password");
lv_obj_set_width(password_ta, 240-12);
lv_obj_set_pos(password_ta, 6,6);
lv_obj_t *password_ta2 = lv_ta_create(lv_scr_act(), password_ta);
lv_obj_t *kb = lv_kb_create(lv_scr_act(), NULL);
lv_kb_set_ta(kb, password_ta2);
lv_obj_set_size(kb,240,180);
lv_obj_align(kb, NULL, LV_ALIGN_IN_BOTTOM_MID,0,0);
The password_ta2’s text is already copied from password_ta ( = 1234567890
).
However it shows 1234567890
, it doesn’t show **********
How to show **********
by default after copying password-mode TextArea?
Thank you.
Found at :
I tried to change from
ext->pwd_mode = copy_ext->pwd_mode;
To
ext->pwd_mode = copy_ext->pwd_mode;
if(ext->pwd_mode != 0) pwd_char_hider( new_ta);
It’s ok now. The new copied one is already shown as **********
.
I updated the ta_placeholder_copy
branch with your change; does it work properly now?
The new copied one is already shown as **********
.
But when typing by touch-keyboard , it occurs error at runtime.
Yes, I saw your other post.
Probably it’s because allocating ext->pwd_tmp
is also missing from the copy.