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

    kind-policeman-40412

    07/30/2020, 4:59 AM
    I have pretty much classes in my project already. Just wanna keep their count minimal. Creating a separate component class for dumb components that does not contain any logic seems too much for me. Again the logic is contained withing a certain State like this LobbyState. I wanted to render UI and handle all the clicks withing my LobbyState.
  • k

    kind-policeman-40412

    07/30/2020, 5:00 AM
    For more complex components it's fine to create a separate class. I agree.
  • k

    kind-policeman-40412

    07/30/2020, 5:05 AM
    @User btw linux target with access to button by id is also compiled but just exits application without any visible stacktrace or exception 🙂
  • f

    fast-rain-20339

    07/30/2020, 5:05 AM
    Try running it with gdb for a stack trace
  • f

    fast-rain-20339

    07/30/2020, 5:05 AM
    gdb yourbuild
    (in the build folder)
    run
    bt
  • k

    kind-policeman-40412

    07/30/2020, 5:06 AM
    hmm ok
  • k

    kind-policeman-40412

    07/30/2020, 5:12 AM
    Copy code
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/usr/lib/libthread_db.so.1".
    [New Thread 0x7ffff6124700 (LWP 40099)]
    [Thread 0x7ffff6124700 (LWP 40099) exited]
    [New Thread 0x7ffff6124700 (LWP 40100)]
    [New Thread 0x7ffff18ba700 (LWP 40101)]
    [New Thread 0x7ffff0e92700 (LWP 40102)]
    [New Thread 0x7fffddee0700 (LWP 40103)]
    [New Thread 0x7fffdda10700 (LWP 40104)]
    [Thread 0x7fffdda10700 (LWP 40104) exited]
    Error : ValueException
    [Thread 0x7ffff18ba700 (LWP 40101) exited]
    [Thread 0x7ffff6124700 (LWP 40100) exited]
    [Thread 0x7fffddee0700 (LWP 40103) exited]
    [Thread 0x7ffff7a72740 (LWP 40095) exited]
    [Inferior 1 (process 40095) exited with code 0377]
    (gdb) bt
    No stack.
    (gdb)
    Have no clue what ValueException is related to.
  • f

    fast-rain-20339

    07/30/2020, 5:13 AM
    😬 Not super useful 😐 Worth a shot. I'm all out of ideas I'm afraid!
  • k

    kind-policeman-40412

    07/30/2020, 5:14 AM
    The code that fails now is:
    Copy code
    private function onReady(event:UIEvent):Void
        {
            trace('onReady -> ui:', ui);
            trace('onReady -> event:', event);
    
            ui.joinButton.onClick = function() {
                if (isValidName())
                {
                    switchToNextState();
                }
                else
                {
                    trace('Player name invalid');
                }
            };
        }
  • k

    kind-policeman-40412

    07/30/2020, 5:14 AM
    Yeah. me too ))
  • k

    kind-policeman-40412

    07/30/2020, 5:15 AM
    The code inside the onClick handler is not called.
  • k

    kind-policeman-40412

    07/30/2020, 5:15 AM
    So it's not related.
  • f

    fast-rain-20339

    07/30/2020, 5:16 AM
    Can you trace
    ui.joinButton
    ?
  • k

    kind-policeman-40412

    07/30/2020, 5:17 AM
    null
  • k

    kind-policeman-40412

    07/30/2020, 5:17 AM
    so this is the ValueException from
  • k

    kind-policeman-40412

    07/30/2020, 5:18 AM
    so strange because joinButton is there
  • k

    kind-policeman-40412

    07/30/2020, 5:19 AM
    oh maybe onClick="" is the case now. it was added when I first found that joinButton is null ))
  • k

    kind-policeman-40412

    07/30/2020, 5:20 AM
    no. does not help.
  • k

    kind-policeman-40412

    07/30/2020, 5:22 AM
    Ok, you've tried a lot. Thank you so much for your time. Maybe something is broken with buildComponent idk. Or it just works the other way.
  • f

    fast-rain-20339

    07/30/2020, 5:28 AM
    Was afk - no worries. Strange stuff. Good luck!
  • b

    bright-gpu-74537

    07/30/2020, 5:32 AM
    Still having issues @User ?
  • k

    kind-policeman-40412

    07/30/2020, 5:41 AM
    @User yes the same )
  • k

    kind-policeman-40412

    07/30/2020, 5:41 AM
    any suggestions you can provide?
  • b

    bright-gpu-74537

    07/30/2020, 5:42 AM
    So, just to understand the problem, you want to refer to items in your xml by id in a haxe class?
  • k

    kind-policeman-40412

    07/30/2020, 5:43 AM
    Ok. At first I've asked here how to pass some context into a pure xml component and to call the method on a context variable from onClick.
  • k

    kind-policeman-40412

    07/30/2020, 5:44 AM
    5Mixer suggested to refer to a button by id
  • b

    bright-gpu-74537

    07/30/2020, 5:45 AM
    you mean calling a haxe class from inside a xml file? Something like
    <button onClick='myHaxeClassInstance.foo()' />
  • k

    kind-policeman-40412

    07/30/2020, 5:45 AM
    yes, exactly
  • k

    kind-policeman-40412

    07/30/2020, 5:46 AM
    this would be ideal solution for me but I'm open to others of course if this is not supported )
  • b

    bright-gpu-74537

    07/30/2020, 5:48 AM
    ok, so thats not really possible, im open to suggestions on how to achieve that and what that would look like from your perspective, its useful, but its also using script, which is less that ideal i would say, the issue, is how to pass "myHaxeClassInstance" to the component (as a script var)... Ill have another thing though, in the mean time, you might think about "reversing" that and having a haxe class do the heavy lifting, example:
1...325326327...1687Latest