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

    full-journalist-82607

    01/07/2023, 9:46 PM
    In fact I send it to you now 🙂
    Copy code
    haxe
    package issues;
    
    import haxe.ui.components.Label;
    import haxe.ui.util.Timer;
    import haxe.ui.containers.VBox;
    
    
    @:xml('
    <vbox width="100%" height="100%">
    <label id="label"/>
    </vbox>')
    class A009 extends VBox { 
        public function new() {
            super();
            label.htmlText = " <b>{{LALA}}</b>"; // this works
    
            Timer.delay(function f() {
                var lab = new Label();
                //addComponent(lab); if the lab is added before it works
                
                lab.htmlText = " <b>{{LALA}}</b>";  // crashes here !
                // lab.htmlText = "<b> LALA </b>";  // this works in all cases
                addComponent(lab);
                
    
            }, 2000);
        }
    
    }
  • f

    full-journalist-82607

    01/07/2023, 9:47 PM
    You don't need to have {{LALA}} defined in a locale
  • b

    bright-gpu-74537

    01/07/2023, 9:48 PM
    is the timer required?
  • f

    full-journalist-82607

    01/07/2023, 9:49 PM
    It seems required
  • b

    bright-gpu-74537

    01/07/2023, 9:49 PM
    weird
  • b

    bright-gpu-74537

    01/07/2023, 9:49 PM
    ill check it out tomorrow
  • f

    full-journalist-82607

    01/07/2023, 9:50 PM
    Yes, it the weirdest bug I've seen, it seems to send the exact same string, my brain cannot conceive it lol 😵
  • f

    full-journalist-82607

    01/07/2023, 9:51 PM
    Good night ! 🙂
  • f

    full-journalist-82607

    01/07/2023, 9:55 PM
    Okay, just had an idea. Maybe it has to the timing of setting th wxlabel. When you're using the translation, maybe it isn't set at the same time ... Now, good night ! 😉
  • f

    full-journalist-82607

    01/08/2023, 10:49 AM
    Oh , in fact it's not a htmlText bug , it's a text bug. It does the same for simple .text
  • b

    bright-gpu-74537

    01/08/2023, 12:39 PM
    hmmm, weird... so i wonder if the locale stuff is "forcing" something before something is ready... certainly shouldnt be the case
  • f

    few-pizza-8232

    01/08/2023, 6:04 PM
    Playing around with HaxeUI Kha, I noticed that
    ComponentGraphics
    isn't implemented. It seems that rendering in that backend occurs per-component using the
    renderTo
    function. Since
    ComponentGraphics
    doesn't implement
    Component
    , the implementation can't access that directly. If I were to try to create a non-dummy
    ComponentGraphicsImpl
    , would the most idiomatic way be to: - create a custom subclass of
    Component
    , like
    ComponentGraphicsRenderer
    , defined private to
    ComponentGraphicsImpl.hx
    - on instantiation of
    ComponentGraphicsImpl
    , create a
    ComponentGraphicsRenderer
    with reference to the
    ComponentGraphics
    object, and add as a child of the
    Component
    - override the
    renderTo
    functions in
    ComponentGraphicsRenderer
    to execute the draw commands in
    ComponentGraphics
    I'm wary about modifying the
    Component
    tree upon instantiation of the
    ComponentGraphics
    object since it seems like various systems depend on consistent order and type of child components. The only other way I can think to do it would be to modify
    ComponentImpl
    to allow delegation in
    renderTo
    , but that seems like a deeper and gnarlier change.
  • b

    bright-gpu-74537

    01/08/2023, 6:14 PM
    so i would probably be inclined to go down a route similar to the raylib one, that is, it caches the draw commands and then paints them:
  • b

    bright-gpu-74537

    01/08/2023, 6:15 PM
    https://github.com/haxeui/haxeui-raylib/blob/main/haxe/ui/backend/ComponentGraphicsImpl.hx
  • b

    bright-gpu-74537

    01/08/2023, 6:15 PM
    https://github.com/haxeui/haxeui-raylib/blob/main/haxe/ui/backend/ComponentImpl.hx#L558-L561
  • b

    bright-gpu-74537

    01/08/2023, 6:16 PM
    @few-pizza-8232
  • f

    few-pizza-8232

    01/08/2023, 6:16 PM
    oh that's much tidier than either approach I had in mind
  • f

    few-pizza-8232

    01/08/2023, 6:17 PM
    no promises I'll pull this together since
    renderCustom
    is meeting my current needs. but if I do I'll submit a PR
  • f

    few-pizza-8232

    01/08/2023, 6:17 PM
    thanks!
  • b

    bright-gpu-74537

    01/08/2023, 6:18 PM
    sounds good 🙂 Even if its just half way there, submit it as i (or you, or anyone) can fill in the blanks... im surprised i forgot about kha here tbh
  • b

    bright-gpu-74537

    01/08/2023, 9:32 PM
    should be fixed now
  • f

    full-journalist-82607

    01/08/2023, 9:41 PM
    Nice ! Fixed Indeed ! 🙂
  • f

    full-journalist-82607

    01/08/2023, 9:43 PM
    Kudos
  • b

    bright-gpu-74537

    01/08/2023, 9:45 PM
    yeah, was a good catch... localemanager would wait for "initialize" event if the component wasnt ready... which on other backends was "fine" but on hxwidgets meant that the native component hadnt been created yet
  • b

    bright-gpu-74537

    01/08/2023, 9:46 PM
    i cant think why i went with initialize in the first place, but it certainly seems like the wrong event
  • f

    full-journalist-82607

    01/08/2023, 9:52 PM
    who knows ? Maybe it was the suggestion of your IDE 🙂
  • b

    bright-gpu-74537

    01/08/2023, 9:53 PM
    possibly... "past Ian" probably just thought "yeah, nice, init seems before ready, thats a good thing... ... right? right?!?!"
  • f

    full-journalist-82607

    01/08/2023, 9:59 PM
    haha, but then it worked (nearly everywhere) so it seemed like a great idea. Actually, translations in menu didn't work on hxwidgets, ( not just the window menu bar ) I wonder, if your fix could have corrected this. (goes checking)
  • b

    bright-gpu-74537

    01/08/2023, 10:00 PM
    im not sure it will, menus are a very special thing in wx... they dont really fit into the rest of haxeui-hxwidgets and have to be handled specially (they arent even technically "windows" in wxWidgets)
  • b

    bright-gpu-74537

    01/08/2023, 10:00 PM
    ill add it to the list to check it out
1...136713681369...1687Latest