[flexcoders] Re: Setting the Font Color for a Selected ComboBox Item

2007-03-27 Thread Paul Whitelock
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, #AA);   

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 #AA 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, #AA) executes all of the list items are
rendered in red (#AA).

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 flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 In theory, if your renderer picks a new font color based on a property,
 they should be ignoring the default color always.
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Paul Whitelock
 Sent: Tuesday, March 27, 2007 7:06 AM
 To: flexcoders@yahoogroups.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





RE: [flexcoders] Re: Setting the Font Color for a Selected ComboBox Item

2007-03-27 Thread Alex Harui
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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Paul Whitelock
Sent: Tuesday, March 27, 2007 8:40 AM
To: flexcoders@yahoogroups.com
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, #AA); 

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 #AA 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, #AA) executes all of the list items are
rendered in red (#AA).

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 flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Alex Harui [EMAIL PROTECTED] wrote:

 In theory, if your renderer picks a new font color based on a
property,
 they should be ignoring the default color always.
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of Paul Whitelock
 Sent: Tuesday, March 27, 2007 7:06 AM
 To: flexcoders@yahoogroups.com 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




 


[flexcoders] Re: Setting the Font Color for a Selected ComboBox Item

2007-03-27 Thread Paul Whitelock
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: #AA;
 font-weight: bold;
 }
 /mx:Style

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

/mx:Canvas


--- In flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
 Behalf Of Paul Whitelock
 Sent: Tuesday, March 27, 2007 8:40 AM
 To: flexcoders@yahoogroups.com
 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, #AA);

 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 #AA 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, #AA) executes all of the list items are
 rendered in red (#AA).

 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 flexcoders@yahoogroups.com
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: flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
 [mailto:flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
 ] On
  Behalf Of Paul Whitelock
  Sent: Tuesday, March 27, 2007 7:06 AM
  To: flexcoders@yahoogroups.com 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