The itemRenderer is very simple. The source is below -- is there another
that way I should code it? Thanks for any suggestions!

Paul

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; backgroundAlpha="1"
horizontalScrollPolicy="off" verticalScrollPolicy="off" >

     <mx:Style>
         .normal {
             color: #0B333C;
         }
         .inactive {
             color: #AA0000;
             font-weight: bold;
         }
     </mx:Style>

     <mx:Label text="{data.name}" styleName="{data.status == 'a' ?
'normal' : 'inactive'}" selectable="false"/>

</mx:Canvas>


--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> The key will be in your renderer code for the ComboBox.  How did you
set
> up coloring?
>
> On occasion, the entire List is destroyed and re-created which can
reset
> your renderers.
>
> -Alex
>
> ________________________________
>
> From: [email protected] [mailto:[EMAIL PROTECTED]
On
> Behalf Of Paul Whitelock
> Sent: Tuesday, March 27, 2007 8:40 AM
> To: [email protected]
> Subject: [flexcoders] Re: Setting the Font Color for a Selected
ComboBox
> Item
>
>
>
> Yes, that's what I would have thought too :-)
>
> On the ComboBox close event this is all I'm doing:
>
> if (cb.selectedItem.status == "a") cb.setStyle("color", "#0B333C");
> else cb.setStyle("color", "#AA0000");
>
> If I select an item in the list that has the color #0B333C (the
> default dark gray font color for list items), then everything is fine
> (the #AA0000 items in the list stay red and the #0B333C items in the
> list stay gray).
>
> If I select a list item that has the red color, then when the
> setStyle("color", "#AA0000") executes all of the list items are
> rendered in red (#AA0000).
>
> A odd thing is that if I next select one of the (now red) list items
> that should be gray, then when the cb.setStyle("color", "#0B333C")
> executes the list items are rendered properly (gray items are gray and
> red items are red).
>
> It seems it's only when setStyle changes the color to something other
> than the default that the itemRenderer no longer has an effect. When
> the color is changed back to the default, then the itemRenderer works
> again.
>
> Very strange, and very irritating :-)
>
> Paul
>
>
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
> , "Alex Harui" aharui@ wrote:
> >
> > In theory, if your renderer picks a new font color based on a
> property,
> > they should be ignoring the default color always.
> >
> > ________________________________
> >
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > Behalf Of Paul Whitelock
> > Sent: Tuesday, March 27, 2007 7:06 AM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
> > Subject: [flexcoders] Setting the Font Color for a Selected ComboBox
> > Item
> >
> > I'm using a ComboBox with an itemRenderer to control the font color
of
> > items in the dropdown list (items in the dropdown list have their
font
> > color determined by a property value for each item).
> >
> > I'd like to have the font color for the selected item in the
ComboBox
> > match the font color that the item has in the dropdown list. By
> > default, this doesn't happen. If I do a "setStyle" on the ComboBox
to
> > manually set the selected item's font color to match the font color
> > the item has in the list, this works to set the selected item's font
> > color, but it also sets the font color for every item in the
dropdown
> > list (it seems to override the itemRenderer).
> >
> > Is there a way that I can set the font color for a selected item in
a
> > ComboBox without impacting the font color (set by an itemRenderer)
of
> > dropdown list items?
> >
> > Thanks for any tips!
> >
> > Paul
> >
>

Reply via email to