# How do i find the "width" of a label?

**URL:** <https://community.thunkable.com/t/how-do-i-find-the-width-of-a-label/1531236>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [September 28, 2021, 10:35am UTC](https://community.thunkable.com/t/how-do-i-find-the-width-of-a-label/1531236 "2021-09-28T10:35:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)\
**Post date:** [September 28, 2021, 10:35am UTC](https://community.thunkable.com/t/how-do-i-find-the-width-of-a-label/1531236/1 "2021-09-28T10:35:27Z")

</div>

Hello Thunkers !  
Tried this:  
 ![SCREEN](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/1/311962bad94a5a0936d4011b7f7042de138655a8.png)  
But as my label is set to “fit content” it will always show 0 (zero value).  
Putting “width” instead of “computed width” will show “fit contents”  
Reading Thunkable Docs, i thought that “computed” is ment to fullfill my problem, as it calculate dimension after rendering on screen. But it seems that i lack alot of knowledge about it.

This is just a simplified example of what i need. Actually, i have alot of labels in a column, and i need to find the highest width of collection, to later set all label`s width to that, so my labels will look like a table column. Setting an absolute value to label is not an option for my issue 😌  
Any ideeas ?  
Thank you.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 28, 2021, 10:48am UTC](https://community.thunkable.com/t/how-do-i-find-the-width-of-a-label/1531236/2 "2021-09-28T10:48:26Z")

</div>

Yes, unfortunately it will give you back the settings that you selected for labels when using `Opens` event. But you can use a button as a label and you will get the `computed width`.

**[Another way]**

Instead of `Screen Opens`, test your code from a `Button Click`. When the screen is opening not all objects are defined so you need to give it a time.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [September 28, 2021, 11:15am UTC](https://community.thunkable.com/t/how-do-i-find-the-width-of-a-label/1531236/3 "2021-09-28T11:15:46Z")

</div>

I made a quick test to show you the issue.

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/2/e25e81f232ffa74c5ae563a6ba9581d03557b764.png)

I had this code to show the label width when it has the letter **Yes** and when it has the sentence **This is a test**.

The output is not encouraging at all

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/6/560413e0e5371a2983176fce277700d60ae5ae95.png)

I changed the code to wait a fraction of a second after changing the text of the label. So this is the code  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/a/4aa2532f35b204f59b9a0bc6dda8425d48a47599.png)

and this is the output  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/1/71d06f6db1360de5490444a91deb360fc138ed7c.png)

The 42 in the first trial is actually the size of the label when it has the default word “Label”.

---

<div class="post-metadata">

**Author:** ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)\
**Post date:** [September 28, 2021, 11:16am UTC](https://community.thunkable.com/t/how-do-i-find-the-width-of-a-label/1531236/4 "2021-09-28T11:16:32Z")

</div>

> [@muneer](#):
>
> nstead of `Screen Opens`, test your code from a `Button Click`. When the screen is opening not all objects are defined so you need to give it a time.

Actually, i set a value to label when screen open only to see that label has value. It has value anyway from the design mode, so was already defined.

> [@muneer](#):
>
> But you can use a button as a label and you will get the `computed width`.

Hope that will wok. Ill test right away. Thank you very much.

---

<div class="post-metadata">

**Author:** ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)\
**Post date:** [September 28, 2021, 11:18am UTC](https://community.thunkable.com/t/how-do-i-find-the-width-of-a-label/1531236/5 "2021-09-28T11:18:58Z")

</div>

> [@muneer](#):
>
> I changed the code to wait a fraction of a second after changing the text of the label. So this is the code

… mmm… ill put wait first to see if it works.

---

<div class="post-metadata">

**Author:** ![mimostel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mimostel/32/107661_2.png) [@mimostel](https://community.thunkable.com/u/mimostel)\
**Post date:** [September 28, 2021, 11:37am UTC](https://community.thunkable.com/t/how-do-i-find-the-width-of-a-label/1531236/6 "2021-09-28T11:37:42Z")

</div>

> [@muneer](#):
>
> Instead of `Screen Opens`, test your code from a `Button Click`. When the screen is opening not all objects are defined so you need to give it a time.

This was the right way. Thank you again.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:15pm UTC](https://community.thunkable.com/t/how-do-i-find-the-width-of-a-label/1531236/7 "2024-11-08T13:15:04Z")

</div>


