Bug with Box ? error =>TypeError: child is null BoxLayout.js:77:9

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

Bug with Box ? error =>TypeError: child is null BoxLayout.js:77:9

tranquiliste
Hello all,

I have an error with Box which I don't know how to correct and I wonder if
it's a bug
I have reproduced the issue in a simple code as followed
*TextBinding.mxml*
<?xml version="1.0" encoding="utf-8"?>

<j:Application
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:ecrans="ecrans.*"
        xmlns:j="library://ns.apache.org/royale/jewel"
        xmlns:js="library://ns.apache.org/royale/basic"
        xmlns:html="library://ns.apache.org/royale/html"
         xmlns:mx="library://ns.apache.org/royale/mx"
        width="100%"
        height="100%">
        <j:initialView>
                <j:View id="EcranBox" width="100%" height="100%">
                        <ecrans:Ecran2 id="Ecran2" />
                </j:View>
        </j:initialView>
</j:Application>

*Ecran2Class.as* which extends Box
package ecrans
{
        import mx.containers.Box;

  public class Ecran2Class extends Box
        {
        // Constructeur
                public function Ecran2Class() {
        }
    }
}

*Ecran2.mxml* which only displays a label
<?xml version="1.0" encoding="utf-8"?>
<ecrans:Ecran2Class
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:ecrans = "ecrans.*"
        xmlns:j="library://ns.apache.org/royale/jewel"
        xmlns:html="library://ns.apache.org/royale/html"
         xmlns:js="library://ns.apache.org/royale/basic"
         xmlns:mx="library://ns.apache.org/royale/mx"
   width="100%"  >
        <fx:Script>
               
        </fx:Script>
        <j:Label text="Name :" />
</ecrans:Ecran2Class>

In that configuration I get an error in the console: /child is null
BoxLayout.js 77:9/ with the following stack
measure
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/containers/beads/BoxLayout.js:77
    updateDisplayList
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/containers/beads/BoxLayout.js:149
    layout
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/containers/beads/BoxLayout.js:115
    performLayout
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/LayoutBase.js:251
    handleInitComplete
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/LayoutBase.js:173
    fireListeners
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/events/EventDispatcher.js:117
    dispatchEventInternal_
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/library/closure/goog/events/eventtarget.js:382
    dispatchEvent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/events/EventDispatcher.js:80
    dispatchEvent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/ElementWrapper.js:243
    addedToParent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/core/Container.js:166
    addedToParent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/containers/Box.js:71
    addElement
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/UIBase.js:405
    addElement
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/GroupBase.js:165
    initializeStrandBasedObject
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/utils/MXMLDataInterpreter.js:241
    generateMXMLArray
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/utils/MXMLDataInterpreter.js:127
    generateMXMLInstances
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/utils/MXMLDataInterpreter.js:271
    addedToParent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/jewel/View.js:69
    addElement
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/jewel/Application.js:144
    initialize
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/jewel/Application.js:295
    start
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/jewel/Application.js:264
    <anonymous>
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/TestBinding.html:253

Behaviour is the same if I extends Ecran2Class with HBox, VBox but it works
with Panel

*Important note if I change the jewel Label (<j:Label>) in a MX Label
(<mx:Label>), it works*

Thanks
Nicolas



-----
Nicolas
--
Sent from: http://apache-royale-users.20374.n8.nabble.com/
Nicolas
Reply | Threaded
Open this post in threaded view
|

RE: Bug with Box ? error =>TypeError: child is null BoxLayout.js:77:9

yishayw

Without looking deeply into the stack trace I would guess the problem is mixing Jewel elements with MX containers. There is code in the MX package that assumes components are UIComponents and as Jewel components are not, errors are not surprising.

 

My suggestion is to either stick to one of components set (either MX or Jewel) or at least wrap Jewel components in MX containers (haven’t tried that). So in your case either replace

 

<j:Label> with <mx:Label> or do <mx:Container><j:Label/></mx:Container>

 

Hope this works for you.

 

From: [hidden email]
Sent: Thursday, July 9, 2020 5:43 PM
To: [hidden email]
Subject: Bug with Box ? error =>TypeError: child is null BoxLayout.js:77:9

 

Hello all,

I have an error with Box which I don't know how to correct and I wonder if
it's a bug
I have reproduced the issue in a simple code as followed
*TextBinding.mxml*
<?xml version="1.0" encoding="utf-8"?>

<j:Application
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:ecrans="ecrans.*"
        xmlns:j="library://ns.apache.org/royale/jewel"
        xmlns:js="library://ns.apache.org/royale/basic"
        xmlns:html="library://ns.apache.org/royale/html"
         xmlns:mx="library://ns.apache.org/royale/mx"
        width="100%"
        height="100%">
        <j:initialView>
                <j:View id="EcranBox" width="100%" height="100%">
                        <ecrans:Ecran2 id="Ecran2" />
                </j:View>              
        </j:initialView>
</j:Application>

*Ecran2Class.as* which extends Box
package ecrans
{
        import mx.containers.Box;

         public class Ecran2Class extends Box
        {
        // Constructeur
                public function Ecran2Class() {
        }
    }
}

*Ecran2.mxml* which only displays a label
<?xml version="1.0" encoding="utf-8"?>
<ecrans:Ecran2Class
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:ecrans = "ecrans.*"
        xmlns:j="library://ns.apache.org/royale/jewel"
        xmlns:html="library://ns.apache.org/royale/html"
         xmlns:js="library://ns.apache.org/royale/basic"
         xmlns:mx="library://ns.apache.org/royale/mx"
   width="100%"  >
        <fx:Script>
               
        </fx:Script>
        <j:Label text="Name :" />
</ecrans:Ecran2Class>

In that configuration I get an error in the console: /child is null
BoxLayout.js 77:9/ with the following stack
measure
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/containers/beads/BoxLayout.js:77
    updateDisplayList
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/containers/beads/BoxLayout.js:149
    layout
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/containers/beads/BoxLayout.js:115
    performLayout
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/LayoutBase.js:251
    handleInitComplete
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/LayoutBase.js:173
    fireListeners
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/events/EventDispatcher.js:117
    dispatchEventInternal_
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/library/closure/goog/events/eventtarget.js:382
    dispatchEvent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/events/EventDispatcher.js:80
    dispatchEvent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/ElementWrapper.js:243
    addedToParent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/core/Container.js:166
    addedToParent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/mx/containers/Box.js:71
    addElement
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/UIBase.js:405
    addElement
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/core/GroupBase.js:165
    initializeStrandBasedObject
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/utils/MXMLDataInterpreter.js:241
    generateMXMLArray
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/utils/MXMLDataInterpreter.js:127
    generateMXMLInstances
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/utils/MXMLDataInterpreter.js:271
    addedToParent
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/jewel/View.js:69
    addElement
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/jewel/Application.js:144
    initialize
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/jewel/Application.js:295
    start
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/org/apache/royale/jewel/Application.js:264
    <anonymous>
file:///Users/nicolasA/Documents/dev/ApacheRoyale/TestBinding/bin/js-debug/TestBinding.html:253

Behaviour is the same if I extends Ecran2Class with HBox, VBox but it works
with Panel

*Important note if I change the jewel Label (<j:Label>) in a MX Label
(<mx:Label>), it works*

Thanks
Nicolas



-----
Nicolas
--
Sent from: http://apache-royale-users.20374.n8.nabble.com/

 

Reply | Threaded
Open this post in threaded view
|

RE: Bug with Box ? error =>TypeError: child is null BoxLayout.js:77:9

tranquiliste
Thanks For the answer, That's what I thought based on my tests.

I will find a way to not have this case

Nicolas



-----
Nicolas
--
Sent from: http://apache-royale-users.20374.n8.nabble.com/
Nicolas