Thanks - yes, happy to adjust our code to that sort of format, but we continue 
to hit the issue that this is a renderer for a list, being set on the list, and 
we want to have a renderer for the list that's being created at runtime from 
the combo box.

It might be that we can set the itemRenderer property of the list object as 
it's created by the combo box's view object, but this feels a little hacky and 
it would be nicer if we could accomplish this just via MXML or CSS..

cheers


-----Original Message-----
From: Yishay Weiss <yishayj...@hotmail.com> 
Sent: 22 July 2019 17:43
To: dev@royale.apache.org
Subject: [EXTERNAL] RE: ComboBox list-item renderer

Another option is to specify the renderer class as an mxml att [1]. 
ItemRenderers are not beads, so adding them to the beads list has no effect (it 
should actually cause an RTE).



[1] 
https://clicktime.symantec.com/3L6uXLP6wp93RxE1KiZmGxT7Vc?u=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Fblob%2Ff637c857122d56f838bab21314a11900ed0add8e%2Fexamples%2Froyale%2FTodoListSampleApp%2Fsrc%2Fmain%2Froyale%2Fsample%2Ftodo%2Fviews%2FTodoListView.mxml%23L169



________________________________
From: Carlos Rovira <carlosrov...@apache.org>
Sent: Monday, July 22, 2019 6:32:27 PM
To: dev@royale.apache.org <dev@royale.apache.org>
Subject: Re: ComboBox list-item renderer

Hi Andrew,

for this one in Royale it use to be done in CSS. For example in tour de jewel 
for List we do:

Source code in GitHub
<https://clicktime.symantec.com/3FLJQLf6LAcXdburoPNGbpg7Vc?u=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Fblob%2Fdevelop%2Fexamples%2Froyale%2FTourDeJewel%2Fsrc%2Fmain%2Froyale%2FListPlayGround.mxml>

<j:List id="iconList" width="200" height="300" className="
iconListItemRenderer" labelField="label">

and in iconListItemRenderer you can find

.iconListItemRenderer
{
IItemRenderer: ClassReference("itemRenderers.IconListItemRenderer");
}

but as well we should can do as inline in MXML, so if that does not work it's a 
bug to solve I think...

HTH

Carlos


El lun., 22 jul. 2019 a las 17:14, Frost, Andrew (<andrew.fr...@harman.com>)
escribió:

> 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>
>
>
>
>
>

--
Carlos Rovira
https://clicktime.symantec.com/36TqgNnCHwLbyQEjPaEJeg57Vc?u=http%3A%2F%2Fabout.me%2Fcarlosrovira

Reply via email to