Maybe it's even should be split into two separate bead. As for your question - initComplete is fired in addedToParent, after all stuff which is done related to current component. Not sure if it's include children, but I would check and give the feedback cause it will be precious information.
Piotr 2017-11-13 14:26 GMT+01:00 Harbs <harbs.li...@gmail.com>: > Is initComplete fired after all the children are added? > > > Also, doesn’t DisableBead work for containers as is? > > No. DisableBead helps in so far as you can’t select using the mouse, but > you can still select using the keyboard by tabbing though controls. For > that to work, you need to disable tabbing on all the descendants. > > > On Nov 13, 2017, at 3:20 PM, Yishay Weiss <yishayj...@hotmail.com> > wrote: > > > > Why not listen to the container’s ‘initComplete’? Also, doesn’t > DisableBead work for containers as is? > > > > > > > > ________________________________ > > From: Piotr Zarzycki <piotrzarzyck...@gmail.com> > > Sent: Monday, November 13, 2017 3:15:54 PM > > To: dev@royale.apache.org > > Subject: Re: [royale-asjs] 01/01: First (non-working) version > > > > Harbs, > > > > First thought is register to "initComplete" for each children ? But does > > each of our children emit such event ? > > > > Piotr > > > > > > 2017-11-13 14:01 GMT+01:00 Harbs <harbs.li...@gmail.com>: > > > >> I need some help here. > >> > >> The code should be working, but the bead is added before the children > are > >> added, so the styles and attributes are not applied. > >> > >> Any ideas on how to delay the execution until after the full tree of > >> children are added? > >> > >> Thanks, > >> Harbs > >> > >>> On Nov 13, 2017, at 2:57 PM, ha...@apache.org wrote: > >>> > >>> This is an automated email from the ASF dual-hosted git repository. > >>> > >>> harbs pushed a commit to branch feature/disable-children-bead > >>> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git > >>> > >>> commit c1cc651a6f03cbcdb6792eed367140404adf7863 > >>> Author: Harbs <ha...@in-tools.com> > >>> AuthorDate: Mon Nov 13 14:57:34 2017 +0200 > >>> > >>> First (non-working) version > >>> --- > >>> .../Basic/src/main/resources/basic-manifest.xml | 1 + > >>> .../royale/html/beads/DisableChildrenBead.as | 152 > >> +++++++++++++++++++++ > >>> 2 files changed, 153 insertions(+) > >>> > >>> diff --git a/frameworks/projects/Basic/src/main/resources/basic- > manifest.xml > >> b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml > >>> index 90b72b3..02a8579 100644 > >>> --- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml > >>> +++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml > >>> @@ -113,6 +113,7 @@ > >>> <component id="UnselectableElementBead" > >> class="org.apache.royale.html.beads.UnselectableElementBead"/> > >>> <component id="DisableBead" class="org.apache.royale.html. > beads.DisableBead" > >> /> > >>> <component id="DisabledAlphaBead" class="org.apache.royale.html. > beads.DisabledAlphaBead" > >> /> > >>> + <component id="DisableChildrenBead" class="org.apache.royale.html. > beads.DisableChildrenBead" > >> /> > >>> <component id="NumericOnlyTextInputBead" > >> class="org.apache.royale.html.accessories.NumericOnlyTextInputBead" /> > >>> <component id="PasswordInputBead" class="org.apache.royale.html. > accessories.PasswordInputBead" > >> /> > >>> <component id="PasswordInputRemovableBead" > >> class="org.apache.royale.html.accessories.PasswordInputRemovableBead" > /> > >>> diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/ > >> royale/html/beads/DisableChildrenBead.as b/frameworks/projects/Basic/ > >> src/main/royale/org/apache/royale/html/beads/DisableChildrenBead.as > >>> new file mode 100644 > >>> index 0000000..ca4ffa1 > >>> --- /dev/null > >>> +++ b/frameworks/projects/Basic/src/main/royale/org/apache/ > >> royale/html/beads/DisableChildrenBead.as > >>> @@ -0,0 +1,152 @@ > >>> +/////////////////////////////////////////////////////////// > >> ///////////////////// > >>> +// > >>> +// Licensed to the Apache Software Foundation (ASF) under one or more > >>> +// contributor license agreements. See the NOTICE file distributed > >> with > >>> +// this work for additional information regarding copyright > ownership. > >>> +// The ASF licenses this file to You under the Apache License, > Version > >> 2.0 > >>> +// (the "License"); you may not use this file except in compliance > with > >>> +// the License. You may obtain a copy of the License at > >>> +// > >>> +// http://www.apache.org/licenses/LICENSE-2.0 > >>> +// > >>> +// Unless required by applicable law or agreed to in writing, > software > >>> +// distributed under the License is distributed on an "AS IS" BASIS, > >>> +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or > >> implied. > >>> +// See the License for the specific language governing permissions > and > >>> +// limitations under the License. > >>> +// > >>> +/////////////////////////////////////////////////////////// > >> ///////////////////// > >>> +package org.apache.royale.html.beads > >>> +{ > >>> + COMPILE::SWF { > >>> + import flash.display.DisplayObjectContainer; > >>> + } > >>> + > >>> + import org.apache.royale.core.IBead; > >>> + import org.apache.royale.core.IStrand; > >>> + import org.apache.royale.core.IUIBase; > >>> + import org.apache.royale.core.UIHTMLElementWrapper; > >>> + import org.apache.royale.events.Event; > >>> + import org.apache.royale.events.IEventDispatcher; > >>> + import org.apache.royale.events.ValueEvent; > >>> + > >>> + COMPILE::JS{ > >>> + import org.apache.royale.core.WrappedHTMLElement; > >>> + import org.apache.royale.core.HTMLElementWrapper; > >>> + } > >>> + /** > >>> + * The DisableBead class is a specialty bead that can be used > with > >>> + * any UIBase. When disabled is true, the bead prevents > >> interaction with the component. > >>> + * The appearance of the component when disabled is controlled > by > >> a separate bead. > >>> + * > >>> + * @langversion 3.0 > >>> + * @playerversion Flash 10.2 > >>> + * @playerversion AIR 2.6 > >>> + * @productversion Royale 0.0 > >>> + */ > >>> + public class DisableChildrenBead implements IBead > >>> + { > >>> + /** > >>> + * constructor. > >>> + * > >>> + * @langversion 3.0 > >>> + * @playerversion Flash 10.2 > >>> + * @playerversion AIR 2.6 > >>> + * @productversion Royale 0.0 > >>> + */ > >>> + public function DisableChildrenBead() > >>> + { > >>> + } > >>> + > >>> + private var _strand:IStrand; > >>> + private var _disabled:Boolean; > >>> + > >>> + /** > >>> + * @copy org.apache.royale.core.IBead#strand > >>> + * > >>> + * @langversion 3.0 > >>> + * @playerversion Flash 10.2 > >>> + * @playerversion AIR 2.6 > >>> + * @productversion Royale 0.0 > >>> + * @royaleignorecoercion HTMLInputElement > >>> + * @royaleignorecoercion org.apache.royale.core.UIBase; > >>> + */ > >>> + public function set strand(value:IStrand):void > >>> + { > >>> + _strand = value; > >>> + updateHost(); > >>> + } > >>> + > >>> + public function get disabled():Boolean > >>> + { > >>> + return _disabled; > >>> + } > >>> + > >>> + /** > >>> + * @private > >>> + * @royaleignorecoercion org.apache.royale.core. > >> HTMLElementWrapper > >>> + */ > >>> + public function set disabled(value:Boolean):void > >>> + { > >>> + if (value != _disabled) > >>> + { > >>> + _disabled = value; > >>> + updateHost(); > >>> + throwChangeEvent(); > >>> + } > >>> + } > >>> + > >>> + private function disabledChangeHandler(e:Event):void > >>> + { > >>> + updateHost(); > >>> + } > >>> + > >>> + private function get host():IUIBase > >>> + { > >>> + return _strand as IUIBase; > >>> + } > >>> + > >>> + COMPILE::JS > >>> + private var _lastTabVal:String; > >>> + > >>> + /** > >>> + * @royaleignorecoercion org.apache.royale.core. > >> HTMLElementWrapper > >>> + */ > >>> + private function updateHost():void > >>> + { > >>> + if(!_strand)//bail out > >>> + return; > >>> + COMPILE::SWF { > >>> + var interactiveObject: > DisplayObjectContainer > >> = _strand as DisplayObjectContainer; > >>> + interactiveObject.mouseChildren = > >> !disabled; > >>> + } > >>> + > >>> + COMPILE::JS { > >>> + setDecendants((_strand as > >> HTMLElementWrapper).element); > >>> + } > >>> + > >>> + } > >>> + > >>> + COMPILE::JS > >>> + private function setDecendants(elem:HTMLElement):void > >>> + { > >>> + elem.style["pointerEvents"] = _disabled ? "none" > : > >> ""; > >>> + _disabled ? elem.setAttribute("tabindex", "-1") : > >> elem.removeAttribute("tabindex"); > >>> + elem = elem.firstChild as HTMLElement; > >>> + while (elem) { > >>> + setDecendants(elem); > >>> + elem = elem.nextSibling as HTMLElement; > >>> + } > >>> + } > >>> + > >>> + private function throwChangeEvent():void > >>> + { > >>> + if (_strand) > >>> + { > >>> + IEventDispatcher(_strand). > dispatchEvent(new > >> ValueEvent("disabledChange", disabled)); > >>> + } > >>> + } > >>> + > >>> + > >>> + } > >>> +} > >>> > >>> -- > >>> To stop receiving notification emails like this one, please contact > >>> "comm...@royale.apache.org" <comm...@royale.apache.org>. > >> > >> > > > > > > -- > > > > Piotr Zarzycki > > > > Patreon: *https://www.patreon.com/piotrzarzycki > > <https://www.patreon.com/piotrzarzycki>* > > -- Piotr Zarzycki Patreon: *https://www.patreon.com/piotrzarzycki <https://www.patreon.com/piotrzarzycki>*