# Listbox customisation

**URL:** <https://forum.kirupa.com/t/listbox-customisation/264951>\
**Category:** flash\
**Created:** [July 2, 2008, 1:08pm UTC](https://forum.kirupa.com/t/listbox-customisation/264951 "2008-07-02T13:08:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ventoline](https://avatars.discourse-cdn.com/v4/letter/v/dec6dc/32.png) [@ventoline](https://forum.kirupa.com/u/ventoline)\
**Post date:** [July 2, 2008, 1:08pm UTC](https://forum.kirupa.com/t/listbox-customisation/264951/1 "2008-07-02T13:08:37Z")

</div>

Hi,

I’m looking for a way to set the font and the font color inside a listbox…  
I’ve lookes to setStyle, and textformat but it doesn’t seem to work…

Please Help!

---

<div class="post-metadata">

**Author:** ![yaim0310](https://avatars.discourse-cdn.com/v4/letter/y/85e7bf/32.png) [@yaim0310](https://forum.kirupa.com/u/yaim0310)\
**Post date:** [July 2, 2008, 5:57pm UTC](https://forum.kirupa.com/t/listbox-customisation/264951/2 "2008-07-02T17:57:14Z")

</div>

you were so close too. =P its actually setRendererStyle() and here is an example from the help files:

```auto
import fl.controls.List;

var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = "Comic Sans MS";

var myList:List = new List();
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.addItem({label:"The quick brown fox..."});
myList.setRendererStyle("textFormat", myTextFormat);
myList.width = 150;
myList.move(10, 10);
addChild(myList);

```

---

<div class="post-metadata">

**Author:** ![ventoline](https://avatars.discourse-cdn.com/v4/letter/v/dec6dc/32.png) [@ventoline](https://forum.kirupa.com/u/ventoline)\
**Post date:** [July 3, 2008, 2:17pm UTC](https://forum.kirupa.com/t/listbox-customisation/264951/3 "2008-07-03T14:17:33Z")

</div>

\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>here is the code i used, but still doesn’t work:\</FONT\>\</P\>  
\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>\</FONT\>&nbsp;\</P\>  
\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>var liste:List = new List();\</FONT\>\</P\>  
\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>liste.addItem…\</FONT\>\</P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>  
\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>liste.setRendererStyle(“textFormat”, “tf”);\</FONT\>\</P\>  
\<P\>liste.width = 100;\</FONT\>\</P\>  
\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>liste.move(250,250);\</FONT\>\</P\>  
\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>addChild(liste);\</FONT\>\</P\>  
\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>\</FONT\>&nbsp;\</P\>  
\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>\</FONT\>&nbsp;\</P\>  
\<P\>\<FONT style=“BACKGROUND-COLOR: #f5f5ff”\>Where do I have it wrong?\</FONT\>\</P\>

---

<div class="post-metadata">

**Author:** ![yaim0310](https://avatars.discourse-cdn.com/v4/letter/y/85e7bf/32.png) [@yaim0310](https://forum.kirupa.com/u/yaim0310)\
**Post date:** [July 3, 2008, 2:55pm UTC](https://forum.kirupa.com/t/listbox-customisation/264951/4 "2008-07-03T14:55:54Z")

</div>

[QUOTE=ventoline;2353069]liste.setRendererStyle(“textFormat”, “tf”);[/QUOTE]

tf should not be a string it should be the TextFormat object, and be sure to make it before setting it to your list  
[AS]var myTextFormat:TextFormat = new TextFormat();  
myTextFormat.font = “Comic Sans MS”;  
myTextFormat.color = 0x0000FF // blue

liste.setRendererStyle(“textFormat”, myTextFormat);[/AS]

---

<div class="post-metadata">

**Author:** ![ventoline](https://avatars.discourse-cdn.com/v4/letter/v/dec6dc/32.png) [@ventoline](https://forum.kirupa.com/u/ventoline)\
**Post date:** [July 3, 2008, 5:54pm UTC](https://forum.kirupa.com/t/listbox-customisation/264951/5 "2008-07-03T17:54:36Z")

</div>

Thanx, A Lot.

---

<div class="post-metadata">

**Author:** ![ventoline](https://avatars.discourse-cdn.com/v4/letter/v/dec6dc/32.png) [@ventoline](https://forum.kirupa.com/u/ventoline)\
**Post date:** [July 3, 2008, 5:55pm UTC](https://forum.kirupa.com/t/listbox-customisation/264951/6 "2008-07-03T17:55:58Z")

</div>

pffew, finally working. weid the documentation shows it as (“textFormat”, “tf”)!!

---

<div class="post-metadata">

**Author:** ![ventoline](https://avatars.discourse-cdn.com/v4/letter/v/dec6dc/32.png) [@ventoline](https://forum.kirupa.com/u/ventoline)\
**Post date:** [July 4, 2008, 6:53pm UTC](https://forum.kirupa.com/t/listbox-customisation/264951/7 "2008-07-04T18:53:19Z")

</div>

Hello, me again!

Now I’m struggling to adjust width and height, and border of cells,

I’ve looked at setstyle, Cellrenderer… it doesn’t seem to work this way…

anyone knows?

---

<div class="post-metadata">

**Author:** ![nikefido](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@nikefido](https://forum.kirupa.com/u/nikefido)\
**Post date:** [July 5, 2008, 3:25am UTC](https://forum.kirupa.com/t/listbox-customisation/264951/8 "2008-07-05T03:25:18Z")

</div>

you don’t have to do that programmatically. You can double click the item in your library and edit them. (when you double click, you’ll see how they set up the components for you so you can edit them as you wish - it’s really neat!)…I’m assuming you are using cs3

---

<div class="post-metadata">

**Author:** ![Felixz](https://avatars.discourse-cdn.com/v4/letter/f/ecb155/32.png) [@Felixz](https://forum.kirupa.com/u/Felixz)\
**Post date:** [July 5, 2008, 1:16pm UTC](https://forum.kirupa.com/t/listbox-customisation/264951/9 "2008-07-05T13:16:16Z")

</div>

```auto
			this.list.rowHeight+=3;

```
