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

    bright-gpu-74537

    12/11/2022, 10:26 PM
    haxeui takes the type from the prop its coming from... so "var x:Float" will mean haxeui will convert the string into a float from xml
  • h

    hallowed-ocean-84954

    12/11/2022, 10:26 PM
    understood which means trying to do it just from XML leaves you without enough info to do the conversion
  • b

    bright-gpu-74537

    12/11/2022, 10:27 PM
    well, the "schema" is the class in essence
  • b

    bright-gpu-74537

    12/11/2022, 10:28 PM
    bizarrely, or amusingly, haxeui USED to try to "guess" the type by what was in the string... i have no idea why i thought that was a good idea, but it wasnt
  • h

    hallowed-ocean-84954

    12/11/2022, 10:28 PM
    well hindsight and all ...
  • h

    hallowed-ocean-84954

    12/11/2022, 10:28 PM
    but we gotta try stuff to know
  • b

    bright-gpu-74537

    12/11/2022, 10:29 PM
    actually, i remember now why that was a thing, it was because, at the time, i didnt have all the types of the fields...
  • b

    bright-gpu-74537

    12/11/2022, 10:29 PM
    so i kinda relied on the compiler to do it for me, but because of Variant, it was, well, iffy
  • b

    bright-gpu-74537

    12/11/2022, 10:30 PM
    now haxeui knows, at compile time, "this is an int", so it does the appropriate conversions - or at least tries to
  • h

    hallowed-ocean-84954

    12/11/2022, 10:30 PM
    ah ... I don't know Variant but I'm guessing some earlier form of Dynamic - I basically don't know Haxe before about 4.2
  • b

    bright-gpu-74537

    12/11/2022, 10:31 PM
    Variant is a haxeui thing, and its a way to avoid dynamic, but honestly, it has its own set of issues... in a lot of ways Dynamic would have been much simpler, though less safe
  • b

    bright-gpu-74537

    12/11/2022, 10:34 PM
    you cant, for example, do "myImage.resource = new SomeRandomClass()"... which dynamic would be fine with
  • b

    bright-gpu-74537

    12/11/2022, 10:35 PM
    you can do
    myImage.resource = "http...."
    or
    myImage.resource = new kha.Image()
    ... all valid... and good...
  • b

    bright-gpu-74537

    12/11/2022, 10:35 PM
    but you can also do:
    myImage.resource = true
    or
    myImage.resource = 123
    ... ... nothing will happen, but they are perfectly valid since they are valid variants
  • b

    bright-gpu-74537

    12/11/2022, 10:38 PM
    so really, it should be something like
    var resource:Either<String, ImageData>
    ... but either is just basically useless in haxe imo
  • b

    bright-gpu-74537

    12/11/2022, 10:39 PM
    or better yet:
    var resource:OneOf<String, ImageData, Foo, Bar, ... >
  • h

    hallowed-ocean-84954

    12/11/2022, 10:42 PM
    oh I see
  • h

    hallowed-ocean-84954

    12/11/2022, 10:44 PM
    I'm trying to a cbk on the UIEvent.READY for the slider and update strings in the labels
  • h

    hallowed-ocean-84954

    12/11/2022, 10:44 PM
    it's working but seems it's not reliably firing and I'm getting the right result sometimes and sometimes not
  • h

    hallowed-ocean-84954

    12/11/2022, 10:44 PM
    It's so I can do this precision in string formatting thing
  • h

    hallowed-ocean-84954

    12/11/2022, 10:45 PM
    is there a way for a custom component to register a cbk on it's own ready event - not a component within it
  • b

    bright-gpu-74537

    12/11/2022, 10:45 PM
    im just about to head off, but you'll have to repro it... ready should certainly fire reliably
  • h

    hallowed-ocean-84954

    12/11/2022, 10:46 PM
    it's in that thing I sent you on the playgriound
  • b

    bright-gpu-74537

    12/11/2022, 10:46 PM
    you can override "onReady" btw
  • b

    bright-gpu-74537

    12/11/2022, 10:46 PM
    which is what i would do
  • h

    hallowed-ocean-84954

    12/11/2022, 10:46 PM
    oh
  • h

    hallowed-ocean-84954

    12/11/2022, 10:46 PM
    I saw that when I did something wrong
  • h

    hallowed-ocean-84954

    12/11/2022, 10:46 PM
    let me try that
  • h

    hallowed-ocean-84954

    12/11/2022, 10:46 PM
    thanx
  • b

    bright-gpu-74537

    12/11/2022, 10:47 PM
    this.registerEvent(UIEvent.READY, ...)
    should be the same though...
1...133213331334...1687Latest