# TextField width of a List component item

**URL:** <https://forum.kirupa.com/t/textfield-width-of-a-list-component-item/263060>\
**Category:** flash\
**Created:** [June 12, 2008, 8:36am UTC](https://forum.kirupa.com/t/textfield-width-of-a-list-component-item/263060 "2008-06-12T08:36:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BMA](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@BMA](https://forum.kirupa.com/u/BMA)\
**Post date:** [June 12, 2008, 8:36am UTC](https://forum.kirupa.com/t/textfield-width-of-a-list-component-item/263060/1 "2008-06-12T08:36:12Z")

</div>

Hi,

is there a way to find out the label textwidth of a list component item?  
list.getItemAt(x) only returns an object but not the reference to the list item class (or whatever it is called :crying: )…

Thanks,  
BMA

---

<div class="post-metadata">

**Author:** ![DiamondDog](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@DiamondDog](https://forum.kirupa.com/u/DiamondDog)\
**Post date:** [June 12, 2008, 9:25am UTC](https://forum.kirupa.com/t/textfield-width-of-a-list-component-item/263060/2 "2008-06-12T09:25:32Z")

</div>

You’re nearly there, I think

Try

```auto
list.getItemAt(x).label.length

```

---

<div class="post-metadata">

**Author:** ![BMA](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@BMA](https://forum.kirupa.com/u/BMA)\
**Post date:** [June 12, 2008, 12:14pm UTC](https://forum.kirupa.com/t/textfield-width-of-a-list-component-item/263060/3 "2008-06-12T12:14:29Z")

</div>

This would be the length of the string stored in the label.  
What I mean is the textwidth in pixels of the textfield containing that string.

Perhaps I should explain what I want to do: my goal is to set the list component’s width to the width of the longest textfield.  
I’m using a skinned list component with a none mono space font.
