# textarea and label

**URL:** <http://forum.squareline.io/t/textarea-and-label/3429>\
**Category:** How to\
**Tags:** lvgl\
**Created:** [June 25, 2024, 11:35am UTC](http://forum.squareline.io/t/textarea-and-label/3429 "2024-06-25T11:35:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![huseyin](http://forum.squareline.io/user_avatar/forum.squareline.io/huseyin/32/1394_2.png) [@huseyin](http://forum.squareline.io/u/huseyin)\
**Post date:** [June 25, 2024, 11:35am UTC](http://forum.squareline.io/t/textarea-and-label/3429/1 "2024-06-25T11:35:04Z")

</div>

### What do you want to achieve?

### What have you tried so far?

### Screenshot or video

Hello, I can display the data entered from the keyboard on the textarea. I would like to see the data I enter from the keyboard into the textarea on a label, can you help me?

### Others

- **SquareLine Studio version:**
- **Operating system:**
- **Target hardware:**

---

<div class="post-metadata">

**Author:** ![viti](http://forum.squareline.io/letter_avatar_proxy/v4/letter/v/9f8e36/32.png) [@viti](http://forum.squareline.io/u/viti)\
**Post date:** [June 26, 2024, 9:47pm UTC](http://forum.squareline.io/t/textarea-and-label/3429/2 "2024-06-26T21:47:19Z")

</div>

Hi!

You need 2 functions:

- void lv\_label\_set\_text(lv\_obj\_t \*obj, const char \*text)  
with this you can modify the text of the label  
more:  
[Label (lv\_label) — LVGL documentation](https://docs.lvgl.io/8.3/widgets/core/label.html?highlight=lv_label_set_text#_CPPv417lv_label_set_textP8lv_obj_tPKc)

- const char \*lv\_textarea\_get\_text(const lv\_obj\_t \*obj)  
with this you can get the text of a text area  
more:  
[Text area (lv\_textarea) — LVGL documentation](https://docs.lvgl.io/8.3/widgets/core/textarea.html?highlight=lv_textarea_get_text#_CPPv420lv_textarea_get_textPK8lv_obj_t)

//Example: this is the loop for calling lv\_timer\_handler:  
while (1) {  
lv\_timer\_handler();  
delay(10);  
//In this line you can set the “ui\_your\_Label\_name” value from “ui\_your\_TextArea\_name”  
lv\_label\_set\_text(ui\_your\_Label\_name, lv\_textarea\_get\_text(ui\_your\_TextArea\_name));  
}

Have a good work  
viti

---

<div class="post-metadata">

**Author:** ![Hermit](http://forum.squareline.io/user_avatar/forum.squareline.io/hermit/32/971_2.png) [@Hermit](http://forum.squareline.io/u/Hermit)\
**Post date:** [July 1, 2024, 7:45am UTC](http://forum.squareline.io/t/textarea-and-label/3429/3 "2024-07-01T07:45:15Z")

</div>

Thanks for the detailed answer Viti. I would only add that you can do the text-copying/setting even in a VALUE\_CHANGED event of the textarea-widget instead of continuous call to lv\_label\_set\_text, to probably save some CPU-resources, especially if the text is large. (I guess LVGL only updates the graphic for the text area when it actually changes, so it only performs an internal copying in other cases. With the other event-based solution maybe an initial explicit copying would be needed to update the label for the first time.)
