The List draws highlight and selection underneath the renderer. If you've fully painted the background of your renderer, you've effectively turned it off, and then you can set the background to any color you want based on whether you're highlighted or selected.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Wright Sent: Friday, May 11, 2007 10:48 AM To: [email protected] Subject: [flexcomponents] Re: How to change background/highlight/selected color in an itemRenderer? Ok. I guess backgroundColor is a breeze. I got that working, and using a little logic from your examples, I have the selection and highlight colors showing. This is only a third of the problem though, and the easy third I think. If I'm thinking about this right, the List, for example, handles the highlight and selection drawing itself? Not the individual renderers? I've looked at the code for the default TreeItemRenderer and ListItemRenderer and they don't do anything with highlighting and selection colors. So to do what I want to do can I turn off the List's highlighting and selection stuff, and handle it all in the itemRenderer via changing the background color based on the isSelected and isHighlighted bools? I guess that will work, but seems hacky. I just wanted to: setStyle("selectionColor", color); setStyle("highlightColor", anotherColor); Guess I'm pipe dreaming. Thanks for the ideas. --- In [email protected] <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > The backgroundColor defaults to transparent so that the highlight and > selection can be seen underneath the renderer. > > You should be able to set backgroundColor to some color and get a > background as long as the component you are subclassing implements a > background (some don't). You can always just draw a colored rectangle. > If you do have a backgroundColor you won't see highlight and selection > unless you draw your own representation or turn off the background. > > There are examples related to this on my blog > http://blogs.adobe.com/aharui/item_renderers/ <http://blogs.adobe.com/aharui/item_renderers/> > > ________________________________ > > From: [email protected] <mailto:flexcomponents%40yahoogroups.com> > [mailto:[email protected] <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of Aaron Wright > Sent: Thursday, May 10, 2007 4:29 PM > To: [email protected] <mailto:flexcomponents%40yahoogroups.com> > Subject: [flexcomponents] How to change background/highlight/selected > color in an itemRenderer? > > > > I've been trying to change the background, highlight, and selected > color of items in a tree or list using custom itemRenderers. I haven't > been able to do it yet. I can set the color of children components of > the itemRenderer, but it seems the background, highlight, and selected > color are part of the owner (tree or list). > > What should the itemRenderer be doing to accomplish this? >
