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

    bright-gpu-74537

    06/12/2020, 9:58 AM
    .style is an object on the component though (a Style object). .styleString will take a string and merge it into the .customStyle object (which will later be merged into the .style)
  • b

    bright-gpu-74537

    06/12/2020, 9:58 AM
    the haxeui macros (which arent in effect for you) will take the style attribute and turn it into styleString
  • b

    bright-gpu-74537

    06/12/2020, 9:59 AM
    and realistically, you should never use .style anyway, you should use .customStyle (the names are all wrong)... in an upcoming version (which has fallen behind) the names are going to change
  • b

    bright-gpu-74537

    06/12/2020, 9:59 AM
    .style
    will become
    .computedStyle
    and
    .customStyle
    will become
    .style
  • c

    cool-psychiatrist-49311

    06/12/2020, 9:59 AM
    oh so customStyle is like "override"
  • c

    cool-psychiatrist-49311

    06/12/2020, 9:59 AM
    ok make sense
  • b

    bright-gpu-74537

    06/12/2020, 9:59 AM
    exactly...
  • b

    bright-gpu-74537

    06/12/2020, 10:00 AM
    the style is the computed style of what to draw, it gets that (basically) by computing it from style sheets and then merging over the top anything in the customstyle
  • b

    bright-gpu-74537

    06/12/2020, 10:00 AM
    (again, the names are wrong here and cause confusion)
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:00 AM
    ok got it
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:10 AM
    ok with some special handling it is working now
  • b

    bright-gpu-74537

    06/12/2020, 10:13 AM
    thats interesting... i like that "style.prop" stuff
  • b

    bright-gpu-74537

    06/12/2020, 10:13 AM
    is that valid xml?
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:14 AM
    it is valid hxx 🙂
  • b

    bright-gpu-74537

    06/12/2020, 10:14 AM
    right, will the haxe parser allow it, lemme check
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:15 AM
    You mean inline markup?
  • b

    bright-gpu-74537

    06/12/2020, 10:15 AM
    i will allow it
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:15 AM
    or the xml parser?
  • b

    bright-gpu-74537

    06/12/2020, 10:15 AM
    no i meant the full stop in the attribute
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:15 AM
    btw for this to work I have to add
    @:structInit
    to
    Style
  • b

    bright-gpu-74537

    06/12/2020, 10:15 AM
    Copy code
    haxe
            var x = "<root attr.foo='value' />";
            var xml = Xml.parse(x).firstElement();
            trace(xml.get("attr.foo"));
  • b

    bright-gpu-74537

    06/12/2020, 10:16 AM
    @structInit is probably a decent change there anyway
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:16 AM
    because this dot syntax is translated to an anon object decl at compile time
  • b

    bright-gpu-74537

    06/12/2020, 10:16 AM
    yeah, what does the generated code look like for that dot synax?
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:16 AM
    style.width=${300} style.backgroundColor=${0xff0000}
    is same as
    style=${{width: 300, backgroundColor: 0xff0000}}
  • b

    bright-gpu-74537

    06/12/2020, 10:17 AM
    and what would the haxe generated code look like?
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:17 AM
    and becomes
    vbox.customStyle = {width: 300, backgroundColor: 0xff0000}
  • b

    bright-gpu-74537

    06/12/2020, 10:17 AM
    gotcha
  • c

    cool-psychiatrist-49311

    06/12/2020, 10:17 AM
    with structInit it works nicely
  • b

    bright-gpu-74537

    06/12/2020, 10:17 AM
    i like that... i like the a) structInit stuff and b) the dot syntax in general
1...276277278...1687Latest