Just subclass. With all humble respect, most developers do not have the time, and sometimes the ability, to extend the framework quickly to meet simple requirements like this. I say this only to point out the different perspectives between a flex framework engineer and an average or beginner flex developer. Sure, the power of flex is that you can always roll your own; when necessary. All for that!!! The problem though, is that this may be too much to ask from a developer with a deadline. Before flex, I came from the Microsoft camp. I absolutely appreciate the freedom that flex affords, to extend the framework and/or create components from scratch. But, the built-in properties and styles that flex offers is not quite as comprehensive as what I was previously used to. That being said, I'd love to see the best of both worlds in the next generation of flex. I guess it boils down to the budget and scope of each release of flex. Of course, the framework can't account for every possible use-case. However, there are quite a few common functions and styles, that could be considered to be included. I've had to do something like "all" or "none" many times with a ComboBox. For a cleanly coded application, I'd much rather just be able to set a property, like prompt (but more like reset), instead of adding a sub classed control or hacking a solution through the dataProvider. Just .02 and a pseudo rant. :)
-TH --- In flexcoders@yahoogroups.com, Alex Harui <[EMAIL PROTECTED]> wrote: > > An example of such on my blog > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tim Hoff > Sent: Monday, November 03, 2008 2:08 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: adding (none) option to comboboxes > > > Hi Derrick, > > The ComboBox prompt will not solve your problem here. It only appears > when the selectedIndex==-1; Unless you want to subclass ComboBox, > you're going to have to add "none" to the dataProvider, and implement > custom logic to account for it. Since you're using the same > dataProvider elsewhere, I suggest that you use the object utility copy > function, to make a deep copy of the collection; to be used for the > ComboBox with "none" added. > > -TH > > --- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, "Derrick Anderson" > no.way.this.is.in.use@ wrote: > > > > nevermind, i discovered the 'prompt' property :) > > > > On Mon, Nov 3, 2008 at 3:04 PM, Derrick Anderson < > > no.way.this.is.in.use@ wrote: > > > > > hi, i know this is probably a simple question- but what's the best > way of > > > adding a (none) label to a combobox. i have a setter for the > dataprovider > > > where I add an option for (None) in the list, but I don't actually > want it > > > in the dataprovider if that makes sense. Basically, I want (None) to > always > > > be a selectable item in comboboxes, but I don't actually want to put > that > > > option in the arraycollection combobox dataprovider. here is the > setter for > > > the combobox dataprovider > > > > > > public function set segmentList(list:ArrayCollection):void > > > { > > > _segmentList = list; > > > var item:DataSegmentVO = new DataSegmentVO(); > > > item.dataSegmentID = 0; > > > item.dataSegmentName = '(None)'; > > > > > > if(_segmentList[0].dataSegmentID != 0) > > > _segmentList.addItemAt(item,0); > > > > > > > > > dispatchEvent(new Event("segmentsChanged")); > > > } > > > > > > the problem is that same segmentList arraycollection is used in the > place I > > > manage segments, and it puts a (none) option in there and it doesn't > make > > > sense there. > > > > > > thanks, > > > derrick anderson > > > > > >