Add Beads

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Add Beads

hiedra

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 | Threaded
Open this post in threaded view
|

Re: Add Beads

Harbs
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

hiedra

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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

yishayw

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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: [hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

hiedra

Hi Yishay, look...

 

 

 

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 <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: [hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

yishayw

Can you post the code for your bead?

 

From: [hidden email]
Sent: Monday, June 15, 2020 3:41 PM
To: [hidden email]
Subject: RE: Add Beads

 

Hi Yishay, look...

 

 

 

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 <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: [hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

hiedra

You mean this:

 

        private var textPromptBead:ComboBoxTextPrompt;

 

        public function ComboBoxWP() {

            super();

        }

 

        override public function addedToParent():void

        {

            super.addedToParent();

            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }else{

                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

 

 

De: Yishay Weiss <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:49
Para: [hidden email]
Asunto: RE: Add Beads

 

Can you post the code for your bead?

 

From: [hidden email]
Sent: Monday, June 15, 2020 3:41 PM
To: [hidden email]
Subject: RE: Add Beads

 

Hi Yishay, look...

 

 

 

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 <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: [hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

yishayw

Ok, I just realized you were using a Jewel bead and not a custom one. Looking at the source it seems to listen to ‘beadsAdded’ to take action. Because most beads are added on addedToParent() the event will have already been triggered. I suggest to add it before super.addedToParent(). In other words, instead of

 

        override public function addedToParent():void

        {

            super.addedToParent();

            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }else{

                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");

            }

        }

 

Try

 

        override public function addedToParent():void

        {

            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }else{

                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");

            }

            super.addedToParent();

        }

 

 

 

From: [hidden email]
Sent: Monday, June 15, 2020 3:53 PM
To: [hidden email]
Subject: RE: Add Beads

 

You mean this:

 

        private var textPromptBead:ComboBoxTextPrompt;

 

        public function ComboBoxWP() {

            super();

        }

 

        override public function addedToParent():void

        {

            super.addedToParent();

            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }else{

                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

 

 

De: Yishay Weiss <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:49
Para: [hidden email]
Asunto: RE: Add Beads

 

Can you post the code for your bead?

 

From: [hidden email]
Sent: Monday, June 15, 2020 3:41 PM
To: [hidden email]
Subject: RE: Add Beads

 

Hi Yishay, look...

 

 

 

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 <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: [hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

hiedra
In reply to this post by hiedra

I forgot,…

Yes, I have debugged and the bead is added correctly and the textprompt also recognizes it:

Before adding it:

 

 

After:

 

 

You mean this?

 

De: Maria Jose Esteve <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:42
Para: [hidden email]
Asunto: RE: Add Beads

 

Hi Yishay, look...

 

 

 

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 <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To:
[hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: Add Beads

Harbs
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 <[hidden email]> 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 <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 14:42
Para: [hidden email]
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 <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: 
[hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;
            if (localtextPromptBead == null) {              
                textPromptBead = new ComboBoxTextPrompt;                
                textPromptBead.prompt = _textPrompt;
                addBead(textPromptBead);
            }
        }
 
        private var _textPrompt:String = "\u21F2 ...";
        [Bindable]
        public function get textPrompt():Stringreturn _textPrompt; }
        public function set textPrompt(value:String):void
        { 
            _textPrompt = value;
            textPromptBead.prompt = _textPrompt;
        }
 
Thank you.
Hiedra
 
De: Harbs <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

hiedra
In reply to this post by yishayw

Perfect!!!!

 

 

I take note, the truth is that I could have tried it like that, but I did not think it would work ... poorly thought 😝

 

Thanks,

Hiedra.

 

De: Yishay Weiss <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 15:01
Para: [hidden email]
Asunto: RE: Add Beads

 

Ok, I just realized you were using a Jewel bead and not a custom one. Looking at the source it seems to listen to ‘beadsAdded’ to take action. Because most beads are added on addedToParent() the event will have already been triggered. I suggest to add it before super.addedToParent(). In other words, instead of

 

        override public function addedToParent():void

        {

            super.addedToParent();

            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }else{

                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");

            }

        }

 

Try

 

        override public function addedToParent():void

        {

            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }else{

                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");

            }

            super.addedToParent();

        }

 

 

 

From: [hidden email]
Sent: Monday, June 15, 2020 3:53 PM
To: [hidden email]
Subject: RE: Add Beads

 

You mean this:

 

        private var textPromptBead:ComboBoxTextPrompt;

 

        public function ComboBoxWP() {

            super();

        }

 

        override public function addedToParent():void

        {

            super.addedToParent();

            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }else{

                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

 

 

De: Yishay Weiss <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:49
Para: [hidden email]
Asunto: RE: Add Beads

 

Can you post the code for your bead?

 

From: [hidden email]
Sent: Monday, June 15, 2020 3:41 PM
To: [hidden email]
Subject: RE: Add Beads

 

Hi Yishay, look...

 

 

 

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 <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: [hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

hiedra
In reply to this post by Harbs

Harbs, also works:

 

 

        override public function addedToParent():void

        {

            

            super.addedToParent();

            

            var localdisabledBead:ComboBoxDisabled = getBeadByType(ComboBoxDisabledas ComboBoxDisabled;

            if (localdisabledBead == null) {

                disabledBead = new ComboBoxDisabled();

                disabledBead.disabled = _disabledBead;

                addBead(disabledBead);

            }

            var localtruncateTextBead:ComboBoxTruncateText = getBeadByType(ComboBoxTruncateTextas ComboBoxTruncateText;

            if (localtruncateTextBead == null) {                

                truncateTextBead = new ComboBoxTruncateText;

                addBead(truncateTextBead);

            }

            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }else{

                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");

            }

            

            sendEvent(this,"beadsAdded");

        }

 

 

Thanks to both of you.

Hiedra.

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 15:07
Para: [hidden email]
Asunto: Re: Add Beads

 

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 <[hidden email]> 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 <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 14:42
Para: [hidden email]
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 <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: 
[hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

Re: Add Beads

Harbs
Cool.

There might be beads which assume beadsAdded is only dispatched once, so Yishay’s solution is probably better.


On Jun 15, 2020, at 6:20 PM, Maria Jose Esteve <[hidden email]> wrote:

Harbs, also works:
 
 
        override public function addedToParent():void
        {
            
            super.addedToParent();
            
            var localdisabledBead:ComboBoxDisabled = getBeadByType(ComboBoxDisabledas ComboBoxDisabled;
            if (localdisabledBead == null) {
                disabledBead = new ComboBoxDisabled();
                disabledBead.disabled = _disabledBead;
                addBead(disabledBead);
            }
            var localtruncateTextBead:ComboBoxTruncateText = getBeadByType(ComboBoxTruncateTextas ComboBoxTruncateText;
            if (localtruncateTextBead == null) {                
                truncateTextBead = new ComboBoxTruncateText;
                addBead(truncateTextBead);
            }
            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;
            if (localtextPromptBead == null) {              
                textPromptBead = new ComboBoxTextPrompt;                
                textPromptBead.prompt = _textPrompt;
                addBead(textPromptBead);
            }else{
                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");
            }
            
            sendEvent(this,"beadsAdded");
        }
 
 
Thanks to both of you.
Hiedra.
 
De: Harbs <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 15:07
Para: [hidden email]
Asunto: Re: Add Beads
 
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 <[hidden email]> 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 <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 14:42
Para: [hidden email]
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 <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: 
[hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;
            if (localtextPromptBead == null) {              
                textPromptBead = new ComboBoxTextPrompt;                
                textPromptBead.prompt = _textPrompt;
                addBead(textPromptBead);
            }
        }
 
        private var _textPrompt:String = "\u21F2 ...";
        [Bindable]
        public function get textPrompt():Stringreturn _textPrompt; }
        public function set textPrompt(value:String):void
        { 
            _textPrompt = value;
            textPromptBead.prompt = _textPrompt;
        }
 
Thank you.
Hiedra
 
De: Harbs <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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 | Threaded
Open this post in threaded view
|

RE: Add Beads

hiedra

Okay, well I'll do it then.

 

Hiedra.

 

De: Harbs <[hidden email]>
Enviado el: lunes, 15 de junio de 2020 17:42
Para: [hidden email]
Asunto: Re: Add Beads

 

Cool.

 

There might be beads which assume beadsAdded is only dispatched once, so Yishay’s solution is probably better.

 



On Jun 15, 2020, at 6:20 PM, Maria Jose Esteve <[hidden email]> wrote:

 

Harbs, also works:

 

 

        override public function addedToParent():void

        {

            

            super.addedToParent();

            

            var localdisabledBead:ComboBoxDisabled = getBeadByType(ComboBoxDisabledas ComboBoxDisabled;

            if (localdisabledBead == null) {

                disabledBead = new ComboBoxDisabled();

                disabledBead.disabled = _disabledBead;

                addBead(disabledBead);

            }

            var localtruncateTextBead:ComboBoxTruncateText = getBeadByType(ComboBoxTruncateTextas ComboBoxTruncateText;

            if (localtruncateTextBead == null) {                

                truncateTextBead = new ComboBoxTruncateText;

                addBead(truncateTextBead);

            }

            var localtextPromptBead:ComboBoxTextPrompt = getBeadByType(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }else{

                trace("BEAD BEAD PROMPT EXIST ------------------------------------------------");

            }

            

            sendEvent(this,"beadsAdded");

        }

 

 

Thanks to both of you.

Hiedra.

 

De: Harbs <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 15:07
Para: [hidden email]
Asunto: Re: Add Beads

 

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 <[hidden email]> 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 <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 14:42
Para: [hidden email]
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 <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 14:25
Para: [hidden email]
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: [hidden email]
Sent: Monday, June 15, 2020 3:04 PM
To: 
[hidden email]
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(ComboBoxTextPromptas ComboBoxTextPrompt;

            if (localtextPromptBead == null) {              

                textPromptBead = new ComboBoxTextPrompt;                

                textPromptBead.prompt = _textPrompt;

                addBead(textPromptBead);

            }

        }

 

        private var _textPrompt:String = "\u21F2 ...";

        [Bindable]

        public function get textPrompt():Stringreturn _textPrompt; }

        public function set textPrompt(value:String):void

        { 

            _textPrompt = value;

            textPromptBead.prompt = _textPrompt;

        }

 

Thank you.

Hiedra

 

De: Harbs <[hidden email]> 
Enviado el: lunes, 15 de junio de 2020 13:52
Para: [hidden email]
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 <[hidden email]> 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.