Since the beadsAdded event is fired after super.addedToParent, you’ll need to 
add your bead before super or dispatch beadsAdded a second time (probably not a 
great idea).

Try Yishay’s suggestion of adding the bead before the super call.

> On Jun 15, 2020, at 4:03 PM, Maria Jose Esteve <mjest...@iest.com> wrote:
> 
> I forgot,…
> Yes, I have debugged and the bead is added correctly and the textprompt also 
> recognizes it:
> Before adding it:
>  
> <image002.png>
>  
> After:
>  
> <image003.png>
>  
> You mean this?
>  
> De: Maria Jose Esteve <mjest...@iest.com> 
> Enviado el: lunes, 15 de junio de 2020 14:42
> Para: users@royale.apache.org
> Asunto: RE: Add Beads
>  
> Hi Yishay, look...
>  
> <image001.png>
>  
>  
> The Combobox, framed in green, has the bead added in the tag directly:
>  
>  
>                     <wp:ComboBoxWP percentWidth="83" 
> localId="comboCentroCoste" labelField="displaytext" valueField="codigo"
>                                 className="truncateLabelListItemRenderer">
>                         <wp:beads>
>                             <j:ComboBoxTextPrompt prompt="\u21F2 ..."/>
>                         </wp:beads>
>                     </wp:ComboBoxWP >
>  
>  
> and the other, framed in red, has it automatically added from the addToParent.
> In the first case it works, and in the second it doesn't.
> I have to say, that my Extension is a .as class, not an mxml, will it have 
> something to do with it?
>  
> Thanks you.
> Hiedra.
>  
> De: Yishay Weiss <yishayj...@hotmail.com <mailto:yishayj...@hotmail.com>> 
> Enviado el: lunes, 15 de junio de 2020 14:25
> Para: users@royale.apache.org <mailto:users@royale.apache.org>
> Asunto: RE: Add Beads
>  
> Hi Hiedra,
> I see nothing wrong. In what sense does it not work for you? Did you try 
> putting a breakpoint in the “set strand” method of ComboBoxTextPrompt?
>  
> From: Maria Jose Esteve <mailto:mjest...@iest.com>
> Sent: Monday, June 15, 2020 3:04 PM
> To: users@royale.apache.org <mailto:users@royale.apache.org>
> Subject: RE: Add Beads
>  
> Hi Harbs, thanks for replying.
> The specific case is an extension of the ComboBox control to which I want to 
> add the default prompt.
> Currently I have added it in addToParent but it doesn't work for me, although 
> with debug, I see that it does add it and configure it correctly. See 
> something wrong?
>  
>         private var textPromptBead:ComboBoxTextPrompt;
>  
>         public function ComboBoxWP() {
>             super();
>         }
>  
>         override public function addedToParent():void
>         {
>             super.addedToParent();
>             var localtextPromptBead:ComboBoxTextPrompt = 
> getBeadByType(ComboBoxTextPrompt) as ComboBoxTextPrompt;
>             if (localtextPromptBead == null) {              
>                 textPromptBead = new ComboBoxTextPrompt;                
>                 textPromptBead.prompt = _textPrompt;
>                 addBead(textPromptBead);
>             }
>         }
>  
>         private var _textPrompt:String = "\u21F2 ...";
>         [Bindable]
>         public function get textPrompt():String{ return _textPrompt; }
>         public function set textPrompt(value:String):void
>         { 
>             _textPrompt = value;
>             textPromptBead.prompt = _textPrompt;
>         }
>  
> Thank you.
> Hiedra
>  
> De: Harbs <harbs.li...@gmail.com <mailto:harbs.li...@gmail.com>> 
> Enviado el: lunes, 15 de junio de 2020 13:52
> Para: users@royale.apache.org <mailto:users@royale.apache.org>
> Asunto: Re: Add Beads
>  
> Good question. :-)
>  
> It depends on the type of bead.
>  
> Any beads that are added using MXML will be added in the addeToParent method. 
> The reason for this is because many beads need the component to be added to 
> the DOM.
>  
> If it’s a bead which does not need the DOM structure to be set up, you can 
> simply add it in the class constructor after super().
>  
> HTH,
> Harbs
>  
> 
> On Jun 15, 2020, at 2:40 PM, Maria Jose Esteve <mjest...@iest.com 
> <mailto:mjest...@iest.com>> wrote:
>  
> Hello,
> I am extending a component and need to add a default bead to it. (This is a 
> jewel control but I imagine it will be similar in basic or mx)
> I have seen in the SDK code that there is no "fixed point" where to add it: 
> in some controls they are added in the same constructor, in others they are 
> added in the addToParent, in others in the addBead ...
>  
> Where should I do it?
>  
> Thank you.
> Hiedra.

Reply via email to