# ComboBox with textWidth unchanged whatever the TextFormat Style applied

**URL:** <https://forum.kirupa.com/t/combobox-with-textwidth-unchanged-whatever-the-textformat-style-applied/327223>\
**Category:** flash\
**Created:** [February 14, 2012, 12:03am UTC](https://forum.kirupa.com/t/combobox-with-textwidth-unchanged-whatever-the-textformat-style-applied/327223 "2012-02-14T00:03:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nouatzi](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@nouatzi](https://forum.kirupa.com/u/nouatzi)\
**Post date:** [February 14, 2012, 12:03am UTC](https://forum.kirupa.com/t/combobox-with-textwidth-unchanged-whatever-the-textformat-style-applied/327223/1 "2012-02-14T00:03:54Z")

</div>

Hi everybody,  
I’m trying to autosize my combobox, according to the textWidth of its biggest items. I’ve got the right textWidth without setting the textFormat, but by setting textFormat, with a bigger font size (like 30), the textWidth stays the same !

```auto

var myFormat : TextFormat = new TextFormat("Trebuchet MS", 30, 0x0000FF);var myCbx
myCbx= new ComboBox ;
myCbx.x = 0;
myCbx.y = 0;
myCbx.textField.setStyle("textFormat",myFormat);
myCbx.textField.setStyle("embedFonts",true);
myCbx.dropdown.setRendererStyle("textFormat",myFormat);
myCbx.dropdown.setStyle("embedFonts",true);

myCbx.addItem({label:"one"});
myCbx.addItem({label:"one more"});

this.addChild(myCbx);

for (var m:uint = 0 ; m < myCbx.length ; m++) {
  myCbx.selectedIndex = m;
  myCbx.drawNow();
  trace(myCbx.textField.textWidth); // here is my trace, unchanged whatever the font size applied to my comboxbox
}

```

Any idea ?  
Thanks
