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

    happy-agent-4114

    01/19/2023, 4:28 PM
    also this doesn't set the checkbox and I'm not entirely sure why
  • h

    happy-agent-4114

    01/19/2023, 4:46 PM
    fixed this, still working on the checkbox listener
  • b

    bright-gpu-74537

    01/19/2023, 5:00 PM
    im not sure im following, can you setup a test project either send here, or on the builder - its usually easier to see code rather than try and grep whats meant
  • h

    happy-agent-4114

    01/19/2023, 5:14 PM
    http://haxeui.org/builder/?ff768824
  • h

    happy-agent-4114

    01/19/2023, 5:14 PM
    I added some comments to mainview for clarity
  • b

    bright-gpu-74537

    01/19/2023, 5:16 PM
    ill have to double check, but i think you might need to listen for a "ItemEvent.COMPONENT_EVENT" on the treeview (as you would with tables and lists)
  • h

    happy-agent-4114

    01/19/2023, 5:16 PM
    I'll try that
  • b

    bright-gpu-74537

    01/19/2023, 5:17 PM
    doesnt seem to work
  • h

    happy-agent-4114

    01/19/2023, 5:18 PM
    yeah I'm not sure how this should work
  • b

    bright-gpu-74537

    01/19/2023, 5:18 PM
    well, usually, you would do something like:
  • b

    bright-gpu-74537

    01/19/2023, 5:19 PM
    Copy code
    haxe
            unitSelector.registerEvent(ItemEvent.COMPONENT_EVENT, (event:ItemEvent) -> {
                trace(event.source.text);
            });
  • h

    happy-agent-4114

    01/19/2023, 5:19 PM
    the thing that's messing with me is that the data of the node doesn't change when the checkbox does
  • h

    happy-agent-4114

    01/19/2023, 5:19 PM
    first is when I remove a check, second is adding one
  • b

    bright-gpu-74537

    01/19/2023, 5:20 PM
    ill check it out, but i would have expected it to... i mean, its all just item renderers
  • h

    happy-agent-4114

    01/19/2023, 5:22 PM
    the code that adds the listener that logs that is
    Copy code
    hx
    var node = coolTree.addNode({text:unitNames[EnumValueTools.getIndex(unit)], checked:(unit==A1)});
    node.onClick = (_:UIEvent) -> {
      if (node.data.checked) {
        gp.units.push(unit);
      }
      else {
        gp.units.remove(unit);
      }
      trace(node.data);
    }
  • h

    happy-agent-4114

    01/19/2023, 5:23 PM
    ok it gets weirder actually
  • h

    happy-agent-4114

    01/19/2023, 5:24 PM
    if I click the label exactly 3 times it reverts to whatever it was at declaration
  • b

    bright-gpu-74537

    01/19/2023, 5:25 PM
    OK, well, i can see why the item event isnt being dispatched, which also explains why the value in .data isnt being updated
  • b

    bright-gpu-74537

    01/19/2023, 5:25 PM
    ... ... bear with me
  • h

    happy-agent-4114

    01/19/2023, 5:25 PM
    http://haxeui.org/builder/?541416cb that behavior doesn't happen on the builder also, which is weird
  • h

    happy-agent-4114

    01/19/2023, 5:25 PM
    the data not changing does but the triple click is bizarre
  • b

    bright-gpu-74537

    01/19/2023, 5:26 PM
    one thing at a time... 🙂
  • h

    happy-agent-4114

    01/19/2023, 5:28 PM
    sorry yeah, I'm also trying to debug in case it's somehow my code
  • b

    bright-gpu-74537

    01/19/2023, 5:53 PM
    http://haxeui.org/builder/?26e28c60
  • b

    bright-gpu-74537

    01/19/2023, 5:54 PM
    ok, this works now... one issue is you get two events... one for change and one for click... thinking of a good way around it... :/
  • h

    happy-agent-4114

    01/19/2023, 5:55 PM
    I think I can work around that
  • h

    happy-agent-4114

    01/19/2023, 5:55 PM
    tysm
  • b

    bright-gpu-74537

    01/19/2023, 5:56 PM
    its shitty though... i dont like it, but technically it is perfectly valid
  • h

    happy-agent-4114

    01/19/2023, 5:58 PM
    it's def good enough for now
  • h

    happy-agent-4114

    01/19/2023, 5:58 PM
    does everything I need it to
1...138813891390...1687Latest