I made a few adjustments to support using the IItemRendererProvider
interface on Menu with UIComponent based renderers.
Then I was able to use a mxml defined mx:HBox based renderer, and have
successfully used it (with some layout tweaks) with some legacy content.

With the approach so far, I still had to add this in part of the Renderer's
script block:

import org.apache.royale.html.beads.controllers.ItemRendererMouseController;
import org.apache.royale.core.IBeadController;

override public function addedToParent():void{
  super.addedToParent();
  if (getBeadByType(IBeadController) == null) {
    addBead(new ItemRendererMouseController());
  }
}

I think I could have done this (the part that checks and adds the
mousecontroller bead) instead
in mx.controls.beads.ListItemRendererInitializer, in
'initializeIndexedItemRenderer' [1] but held off for now. Let me know what
you think about doing it there.


1.
https://github.com/apache/royale-asjs/blob/e9040b9a03dc1e11829914dda74fa92b986ce6ab/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/ListItemRendererInitializer.as#L80


On Thu, Jun 11, 2020 at 4:00 AM Alex Harui <[email protected]> wrote:

> Pretty sure AdvancedDataGrid supports assignable custom itemrenderers
> based on UIComponent.  Might be a bit more work for Menu/MenuBar as the
> current renderers are not UIComponents.
>
> HTH,
> -Alex
>
> On 6/10/20, 1:50 AM, "Greg Dove" <[email protected]> wrote:
>
>     Hi - probably another question for Alex, unless Yishay you have
> something
>     similar you have faced here:
>
>     For mx.controls.Menu :
>      specifically for :
>     set itemRenderer
>     AFAICS I don't think this is hooked up to take precedence over the
> default
>     css IItemRendererFactory for the class, which is picked up in
> addedToParent.
>
>     Do we have other examples I should look at to mirror that, or (based
> on a
>     quick check in the Menu code) should I just do a one-time check in
>     Menu.addedToParent to see if it itemRenderer has already been set and
> avoid
>     the load from valuesManager in there, instead adding the explicit
>     assignment as a bead?
>
>     thanks,
>     Greg
>
>
>

Reply via email to