https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • b

    bright-gpu-74537

    06/19/2020, 5:33 PM
    technically all haxeui components are exposed to the xml parser via the module.xml in haxeui-core
  • b

    bright-gpu-74537

    06/19/2020, 5:34 PM
    (modules do other things btw: https://github.com/haxeui/haxeui-guides/blob/master/modules.md)
  • h

    handsome-television-62908

    06/19/2020, 5:37 PM
    Got it. Thank you! I just had the wrong impression of modules, but I've seen most of this. Just needed to review it - sorry! May I suggest a feature for the ability to forward the
    @:build()
    functionality to modules.xml components? I was thinking about implementing this (not as a feature of modules.xml though) for my project in some fashion
  • b

    bright-gpu-74537

    06/19/2020, 5:38 PM
    in what sense?
  • h

    handsome-television-62908

    06/19/2020, 5:40 PM
    Copy code
    haxe
    @:build(...)
    class MyDialog extends Dialog { // thats it!
    }
    If all I wanted to do was access IDs and buttons or the like in components then adding
    build=true
    to a component in the module file would just expose the same functionality for a component
  • b

    bright-gpu-74537

    06/19/2020, 5:41 PM
    i think you could just create custom components from xml file then
  • b

    bright-gpu-74537

    06/19/2020, 5:41 PM
    > It is also possible to create entire custom components from XML alone and a later use them in either markup or in code. This is also achieved by using the module.xml:
  • b

    bright-gpu-74537

    06/19/2020, 5:41 PM
    Copy code
    xml
    <components>
        <class file="custom/custom1.xml" alias="CustomAlias" />
        <class folder="custom" />
    </components>
  • b

    bright-gpu-74537

    06/19/2020, 5:41 PM
    the dialog is an interesting one...
  • h

    handsome-television-62908

    06/19/2020, 5:41 PM
    That's what I was referring to when I asked why it wasn't possible through the modules.xml
  • b

    bright-gpu-74537

    06/19/2020, 5:41 PM
    i wonder if it would extend from dialog... i dont think it would
  • b

    bright-gpu-74537

    06/19/2020, 5:42 PM
    right gotcha
  • h

    handsome-television-62908

    06/19/2020, 5:42 PM
    If so - then I'm happy haha! No need to code this on my end xD
  • b

    bright-gpu-74537

    06/19/2020, 5:42 PM
    i think it would extend from Component and contain a dialog... which wouldnt be useful
  • b

    bright-gpu-74537

    06/19/2020, 5:43 PM
    so thats interesting
  • b

    bright-gpu-74537

    06/19/2020, 5:44 PM
    pretty sure:
  • b

    bright-gpu-74537

    06/19/2020, 5:44 PM
    Copy code
    // MyCustomDialog.xml
    <dialog>
        <label id="bob" />
    </dialog>
    
    // module.xml
    <components>
        <class file="MyCustomDialog.xml" />
    </components>
    
    // Main.hx
    var d = new MyCustomDialog();
    d.bob = "tim";
    d.show();
  • b

    bright-gpu-74537

    06/19/2020, 5:44 PM
    isnt going to have the desired effect
  • b

    bright-gpu-74537

    06/19/2020, 5:45 PM
    seems like a totally valid use case though
  • b

    bright-gpu-74537

    06/19/2020, 5:48 PM
    i think when creating that class in the macro (mycustomdialog), i could take the root node as the class (after a look up) any attributes on it set in the constructor
  • b

    bright-gpu-74537

    06/19/2020, 5:48 PM
    and then NOT use the root node as the first child (otherwise you would have a dialog in a dialog)
  • b

    bright-gpu-74537

    06/19/2020, 5:49 PM
    ... ... ... ... i like it, its also cleaner for .xml (only) based classes
  • b

    bright-gpu-74537

    06/19/2020, 5:50 PM
    <hbox width="100%" />
    becomes:
  • b

    bright-gpu-74537

    06/19/2020, 5:51 PM
    Copy code
    class MyComponent extends HBox {
        public function new() {
            percentWidth = 100;
        }
    }
  • b

    bright-gpu-74537

    06/19/2020, 5:51 PM
    <vbox id="tim" />
    becomes:
  • b

    bright-gpu-74537

    06/19/2020, 5:51 PM
    Copy code
    class MyComponent extends VBox {
        public function new() {
            id = "tim;
        }
    }
  • b

    bright-gpu-74537

    06/19/2020, 5:51 PM
    etc
  • b

    bright-gpu-74537

    06/19/2020, 6:48 PM
    yup:
  • b

    bright-gpu-74537

    06/19/2020, 6:48 PM
    Copy code
    haxe
                main.findComponent("showDialog2", Button).onClick = function(e) {
                    var dialog2 = new assets.custom.Test2();
                    // wont work as the custom component isnt actually a dialog
                    dialog2.show();
                    
                    // the actual dialog is a child now of the custom component from the xml file
                    var actualDialog = dialog2.findComponent(Dialog);
                    // also wont work as this isnt the custom component anymore, so build macro hasnt added fields
                    //actualDialog.theValue.text = "The new value 2";
                    actualDialog.show();
                }
  • b

    bright-gpu-74537

    06/19/2020, 6:51 PM
    good find / use case... i guess ive never used dialogs in that way, but i think i might in the future as generally i want to do as you do, set a bunch of info, show a dialog, get a bunch of info... so my dialog classes are generally just empty for the build macro. Never thought to use xml components with no class, and if i had, it wouldnt have worked, as above
1...284285286...1687Latest