Hi again

Just in case someone's already done this and knows already how to set it up: we 
want to have an itemRenderer for the ListView part of a ComboBox control, i.e. 
when you click on the ComboBox button and it creates the ListView, we need a 
custom renderer. Currently it's defaulting to StringItemRenderer (from the call 
[1] within the default ItemRendererClassFactory), but we want it instead to use 
the inline MXML [2].

I'm hoping that we can set this up by adding a bead of some sort to the 
ComboBox element that will tell it what item renderer to use; all the item 
renderer examples I can find are just using a list view directly rather than 
being something that's set up via a ComboBox. So far we've created a custom 
View for the ComboBox and we are controlling the creation of the ListView, but 
this creation doesn't then set up any of the MXMLDescriptor values which are 
needed for this to work...

Hope that makes sense. Don't worry if not, we'll get to the bottom of it, but I 
wondered if someone already had done this and knew how to do it :-)

thanks

   Andrew



[1] Current way ItemRenderClassFactory selects the item renderer:
if (_strand is IItemRendererProvider && (_strand as 
IItemRendererProvider).itemRenderer) { ... }
else {
    var itemRendererClass:Class = ValuesManager.valuesImpl.getValue(_strand, 
"iItemRenderer") as Class;  <<<<< we're getting StringItemRenderer here
    if (itemRendererClass) { ... }
    else if (!MXMLDescriptor) { ... }
    <<< we want it to hit this point i.e. not get set up because it falls 
through and then uses the MXMLDescriptor value

[2] Our code:
  <mx:ComboBox width="100" dataProvider="{val}" labelField="subval1">
    <mx:itemRenderer>
      <js:ItemRendererClassFactory>  <<<< was "fx:Component"
        <mx:HBox width="100%" horizontalScrollPolicy="off"> ... layout in here 
...  </mx:HBox>
      </js:ItemRendererClassFactory>
    </mx:itemRenderer>
  </mx:ComboBox>




Reply via email to