Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    AutoChildren: when showAutoChildName: false; is there a way to have that cascade for other autoChildren that are set to have their autoParent be that autoChild?

    v12.0p_2020-02-02/LGPL Deployment

    So this is not a huge deal - but I am curious if there is something that I have not found in the documentation on this. Basically here is the scenario:
    Code:
    isc.defineClass("SomeNiceClass", "VLayout").addProperties({
        height: "100%",
        width: "100%",
        initWidget: function () {
            this.Super("initWidget", arguments);
    
            this.addAutoChild("parentThing");
            this.addAutoChild("firstChildThing");
            this.addAutoChild("secondChildThing");
    
        },
        parentThingDefaults: {
            _constructor: isc.HLayout,
            height: 50,
            width: "100%"
        },
        firstChildThingDefaults: {
            _constructor: isc.HLayout,
            autoParent: "parentThing",
            height: "100%",
            width: "100%",
        },
        secondChildThingDefaults: {
            _constructor: isc.HLayout,
            autoParent: "parentThing",
            height: "100%",
            width: 100,
            align: "right"
        }
    });;
    
    // and then the usage: 
    
    var thing = isc.SomeNiceClass.create({
        showParentThing: false
    });
    Then we get the following warn log:
    ISC_Core.js:1238 *11:02:23.141:WARN:SomeNiceClass:isc_SomeNiceClass_0:no valid parent could be found for String 'parentThing'
    Now I know I could also put in `showFirstChildThing: false, showSecondChildThing: false` - but I kind of want the autoChild system to just know that if an autoParent item is being hidden it should be implied that things that also rely on it as their parent, do the same. Perhaps I am wrong but that feels natural to me.

    I know that I could physically place those two child components within the parent component and make them "real" children of the parenThing - buts assume that I really want to keep the hierarchy of the class very flat, meaning that everything is a direct property of the main class. I am more looking for your opinion on the matter. Does this sound like something I should "want" to do? What do you guys think?

    I am also curious if there is already a way to enforce this - which would not surprise me in the least - because you folks seem to have a way of having already thought of things like this - and it is some sort of property that I missing. If not, I am curious for your thoughts otherwise.

    #2
    Code:
        if (this.addAutoChild("parentThing") != null) {
            // add other things
        }

    Comment


      #3
      I guess I did not mention it, but I was aware I could do this as well. I was more just wondering if there was something built in as some implied functionality, as there have been for many things. That is fine though, this works just fine. Thanks for the response.

      Comment

      Working...
      X