Change order of childComponents inside panel?



  • Is it possible?

    I tried like this but with no luck

    const var PNL = Content.getComponent("PNL");
    
    const var PNLS = [Content.getComponent("PNL1"),
                      Content.getComponent("PNL2"),
                      Content.getComponent("PNL3"),
                      Content.getComponent("PNL4")];
    
    Content.setPropertiesFromJSON("PNL",  {
        "childComponents": [
        {
            "id": "PNL3"
        },
        {
            "id": "PNL1"
        },
        {
            "id": "PNL4"
        },
        {
            "id": "PNL2"
        }]
    });
    


  • I'm pretty sure it's not possible, but if it is you'll need to use the correct format

    For example:

        "childComponents": [
          {
            "type": "ScriptSlider",
            "id": "Knob1",
            "x": 29,
            "y": 43,
            "parentComponent": "Panel1"
          },
    


  • @d-healey You mean I have to set all properties?



  • @ulrik well you definitely will need to set the parentComponent.....



  • @ulrik No idea, you're in uncharted waters, I don't think it's going to work no-matter what you do.



  • @Lindon even if I already have them like this
    Skärmavbild 2021-03-13 kl. 15.13.24.png

    Skärmavbild 2021-03-13 kl. 15.12.59.png



  • @ulrik said in Change order of childComponents inside panel?:

    @Lindon even if I already have them like this
    Skärmavbild 2021-03-13 kl. 15.13.24.png

    Skärmavbild 2021-03-13 kl. 15.12.59.png

    each of those has its parentComponent set....

    copy out this JSON , reorder them then copy that JSON and compare the two....but like Dave says - dont know if it will work even then.



  • @Lindon @d-healey I copied the whole "PNL" JSON, rearranged the childComponents and pasted it in side the "setPropertiesFromJSON" but with no luck, so pasted the rearranged ordered data into the "PNL" JSON and hit apply, and voila, it worked 😲

    Would it then, not be possible to script this outside the JSON?

    Skärmavbild 2021-03-13 kl. 15.24.38.png

    Skärmavbild 2021-03-13 kl. 15.25.09.png



  • @ulrik why dont you try it and see? Tell us what you find...

    PNL.set("childComponents',YourTextString);



  • @Lindon I just told you 😀



  • @ulrik sorry pressed submit too soon, try the set command...see above..



  • @Lindon sorry I misunderstood you



  • @Lindon Haha...no problem



  • @ulrik said in Change order of childComponents inside panel?:

    @Lindon Haha...no problem

    I'm sure you wont, but dont forget to escape the quotes....



  • Don't. The order of the UI elements will be used in the preset storage, also the UI element hierarchy is not supposed to be changed (actually I'm not even sure if you can change the parentComponent property after onInit.

    If you need dynamic UI elements, consider using the ScriptPanel.addChildPanel() method which can be used to dynamically create (and delete) ScriptPanels inside another Panel (they won't show up in the UI component tree and are only accessible by scripting).

    Take a look at this example for how to use this feature:

    https://docs.hise.audio/tutorials/recipes/ui/scriptpanel.html#horizontal-list-example



  • @Christoph-Hart thank you Christoph, I'll take a look 🙂



  • @Christoph-Hart This is fantastic, this solves my reorder problems. I didn't know this was available in Hise, I get surprised all the time 🙂
    Thank you!



  • Yes I kind of sneaked that one in a few months ago, mostly because of the necessity of displaying pending downloads & expansions.



  • @Christoph-Hart how do you set the z depth for the childPanels?
    It doesn't seem to follow the index order in the childPanel array.

    The latest created child should be on top of all, that's working, however if I changed the order inside the childPanels array, it doesn't change the z-depth.

    Is it possible to change it?
    childpanels.gif



  • @ulrik example snippet

    HiseSnippet 2655.3ocuZstbaiaElJIzI1Yc6lN8O8en5GYnpUTjbbtrMMasrjbVMqrrpkr6EOotzjPRnghTKIjkU20yryz7f0Gk9Hz2fsG.dAf2jjcmTlLVCANGfO7ctfCHYOWGCrmmiqRgMGrXJVovWn1egMcbiw5Dak1MUJrsZiwDKyd51XKOkCVLU2yCapTnv8eOSjBa9.E90+42eftktsAVzjhxYNDCbGxDBUzZu8+Vhk0g5l3AjIRRu29sMbra3X4LCfy8UqpLU23i5ivc0YhcOUkBazxjPcb6S0oXOkBO3.GyE8G6L21W9yHdjKsvrapozGFH+lOzwxjgXVqJ9KlvksmBLJ8Djv88Igeo5QDSRT6Bx3K4cfDZHyGEt2xfWMY3Uc8gWAI38.e38D09FtjoTQOLr8X011Tr6PcvDHCKeYUt2+7Wo1vAjvlVYh9GwG5B2Dog1qpVsL5kUqV5sauEXF7nnqzcQ8514hFG2cP81cacB5cnvAXDl1vYxTGa3FshwjpX7QneqAcqeTqb0Mn+DZcVubU3rdbYY+64OGg5ioHK8EXWjM3lr8VDaKhMF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