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

    handsome-television-62908

    11/18/2019, 2:34 AM
    Can custom xml components export custom fields or attributes or properties (whatever you want to call them)? I would just like to use an xml component like
    <BareComponent my-attr="..." />
  • b

    bright-gpu-74537

    11/18/2019, 8:19 AM
    @handsome-television-62908 - certainly. For above you would just need a prop on your class "myattr"
  • b

    bright-gpu-74537

    11/18/2019, 8:21 AM
    there is no drag & drop baked into haxeui, though it has been asked about a number of times, so im happy to include it, i just wonder what features it should have as there is little point in adding a subsystem that isnt good enough, or flexible enough, or whatever and never gets used
  • b

    bright-gpu-74537

    11/18/2019, 8:22 AM
    as for a visual designer (@flaky-scientist-22842)... its in the works: https://twitter.com/IanHarrigan1982/status/1188142998929977344
  • b

    bright-gpu-74537

    11/18/2019, 8:22 AM
    🙂
  • f

    flaky-scientist-22842

    11/18/2019, 8:26 AM
    Sweet! 👍
  • h

    handsome-television-62908

    11/18/2019, 8:42 AM
    @bright-gpu-74537 Is this doable straight out of XML? Thanks!
  • h

    handsome-television-62908

    11/18/2019, 8:43 AM
    And by that I mean like how components can technically be done all in xml
  • b

    bright-gpu-74537

    11/18/2019, 8:45 AM
    ah, right... so you are creating the whole component instance out of xml?
  • b

    bright-gpu-74537

    11/18/2019, 8:45 AM
    ie, no
    @:build
    macro?
  • h

    handsome-television-62908

    11/18/2019, 8:51 AM
    yes in this case I was!
  • h

    handsome-television-62908

    11/18/2019, 8:52 AM
    no
    @:build
    going on here
  • b

    bright-gpu-74537

    11/18/2019, 8:54 AM
    right... its a nice idea... and one ive thought about before, but i havent settled on a format (in the markup)
  • b

    bright-gpu-74537

    11/18/2019, 8:54 AM
    you have any thoughts here?
  • b

    bright-gpu-74537

    11/18/2019, 8:54 AM
    ideally, presumably, you'd want to be able to add vars, getters, setters and functions from the xml
  • b

    bright-gpu-74537

    11/18/2019, 8:57 AM
    i was, initially, thinking something like this:
  • b

    bright-gpu-74537

    11/18/2019, 8:57 AM
    Copy code
    xml
    <vbox>
        <haxe:function name="foo"> <!-- what about params??? returns??? -->
            ...
        </haxe:function>
    
        <haxe:setter>
            ...
        </haxe:setter>
    
        <haxe:getter>
            ...
        </haxe:getter>
    
        <haxe:var name="timmy2" type="String" />
        <haxe:var name="timmy" type="String" bind="button.text" />
    
    
        <button text="Bob" />
    </vbox>
  • b

    bright-gpu-74537

    11/18/2019, 8:58 AM
    but im not so sure now... seems like alot of overhead...
  • h

    handsome-television-62908

    11/18/2019, 8:58 AM
    you're talking about making some sort of hooks through script tags? I was thinking in this case the xml would basically be pure data and we just template the properties in via
    Copy code
    <propbase @prop1 @prop2>
           <label text="${@prop1}"/ 
    </propbase>
  • b

    bright-gpu-74537

    11/18/2019, 9:00 AM
    what would be great is if i could turn this:
  • b

    bright-gpu-74537

    11/18/2019, 9:00 AM
    Copy code
    xml
    <vbox>
        <script>
            function foo(v1) {
                return "bar";
            }
    
            var prop(get, set):String;
            function get_prop() {
                return "bob";
            }
            function set_prop(v) {
                return v;
            }
    
            var timmy2:String;
            @:bind(button.text) var timmy:String;
        </script>
    
        <button text="Bob" />
    </vbox>
  • b

    bright-gpu-74537

    11/18/2019, 9:01 AM
    into something real in haxe code...
  • h

    handsome-television-62908

    11/18/2019, 9:02 AM
    why not make a separate tag called properties which would just inject that portion into a generated class?
  • b

    bright-gpu-74537

    11/18/2019, 9:02 AM
    would you not arguably want functions and vars also?
  • b

    bright-gpu-74537

    11/18/2019, 9:04 AM
    this seems like a pretty typical setup for a custom component (using build macros):
  • b

    bright-gpu-74537

    11/18/2019, 9:04 AM
    Copy code
    haxe
    @:build(...)
    class Something extends Box {
        @:bind(button.text) var something:String;
        var else:Int = -1;
    
        public var prop(get, set):String;
        private function get_prop() {
            return "bob";
        }
        private function set_prop(v) {
            // do something with v, then do other stuff, then send an event, etc
        }
    
        public function foo() {
            return "bar"
        }
    }
  • h

    handsome-television-62908

    11/18/2019, 9:12 AM
    Well, from what you've told me you like to seperate logic from ui where possible . . . and I personally don't like the idea of doing so much "haxe-y" logic through the xml honestly. But if I wanted the ability to make xml components more re-usable when inlined, I'd just want a way to expose attributes of other components through some property/naming alias. Like
    Copy code
    <base...>
           <textfield _text='tfText' />
    </base>
    I guess if you wanted to re-bind it to the script tag you could have something like ...
    Copy code
    <script>
    var myText;
    tfText = function(txt:String="") {
             ....
    }
    </script>
  • b

    bright-gpu-74537

    11/18/2019, 9:15 AM
    yeah, the seperation is a valid point... one of the reasons it doesnt exist at the moment
  • b

    bright-gpu-74537

    11/18/2019, 9:15 AM
    so really, for your use case, all you are trying to do is to link a new property with a new var for external use, eg:
  • h

    handsome-television-62908

    11/18/2019, 9:16 AM
    Also... working with a ScrollView right now and I'm making custom lists with drag-drop sorting --- but the ScrollView starts thinking I'm trying to drag the view. Can I disable this?
1...139140141...1687Latest