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

    clever-oil-61353

    06/28/2020, 7:11 AM
    Item renderer?
  • b

    bright-gpu-74537

    06/28/2020, 7:14 AM
    so for each new item in the listview / tableview an item renderer is created, the data of the item renderer is set to the item from the data source, and anything it with an id is matched, eg:
  • c

    clever-oil-61353

    06/28/2020, 7:15 AM
    Ah that item renderer
  • b

    bright-gpu-74537

    06/28/2020, 7:16 AM
    Copy code
    xml
    <item-renderer>
        <vbox>
            <image id="theImage" />
            <hbox>
                <label id="theLabel1" />
                <label id="theLabel2" />
            </hbox>
        </vbox>
    </item-renderer>
  • b

    bright-gpu-74537

    06/28/2020, 7:17 AM
    Copy code
    myListView.dataSource.add({ theImage: "someimage", theLabel1: "item 1A", theLabel2: "item 1B"});
    myListView.dataSource.add({ theImage: "someimage", theLabel1: "item 2A", theLabel2: "item 2B"});
    myListView.dataSource.add({ theImage: "someimage", theLabel1: "item 3A", theLabel2: "item 3B"});
  • b

    bright-gpu-74537

    06/28/2020, 8:01 AM
    someone just emailed me about "7guis"... never heard of them before
  • b

    bright-gpu-74537

    06/28/2020, 8:01 AM
    https://eugenkiss.github.io/7guis/
  • b

    bright-gpu-74537

    06/28/2020, 9:49 AM
    ... finally 😅
  • f

    fast-rain-20339

    06/28/2020, 9:54 AM
    Congrats, they look great! 😄 I like the dark osx one.
  • b

    bright-gpu-74537

    06/28/2020, 9:55 AM
    yeah, luckily wxwidgets handles osx themes (now), i think in the most recently release
  • b

    bright-gpu-74537

    06/28/2020, 9:55 AM
    i remember a few releases back things looked awful with dark mode on osx
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:21 PM
    is it like the following psuedo-code?
    Copy code
    haxe
    var data = // ... current entry in dataSource
    var renderer // ... current item renderer
    var c = renderer.findComponentById('theImage');
    c.data = data.theImage;
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:24 PM
    Would prefer something like this instead:
    Copy code
    haxe
    var dataSource:DataSource<MyData> = // ...
    var list = new List();
    list.dataSource = dataSource;
    list.renderItem = function(data:MyData, ?cached:Component):Component { /* ... */ }
  • b

    bright-gpu-74537

    06/28/2020, 2:43 PM
    there is
    public var itemRendererFunction(get, set):ItemRendererFunction2;
    but it returns a class not a component instance so that class will still have to end up being an item renderer
  • b

    bright-gpu-74537

    06/28/2020, 2:43 PM
    im also not sure how well the itemRendererFunction works, im pretty sure i didnt add it and ive never personally used it
  • b

    bright-gpu-74537

    06/28/2020, 2:45 PM
    (and yeah, the way it works is like your first snippet, essentially, anyway)
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:47 PM
    so, where is the
    data
    field of a component defined?
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:48 PM
    i want to know how it maps to the "correct" field (like
    .text
    for Label`
  • b

    bright-gpu-74537

    06/28/2020, 2:49 PM
    so .data is on the ItemRenderer, not component and it doesnt do any mapping it sets the .value of the component, which means different things to different components
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:49 PM
    oh I just saw this
    @:value(text)
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:49 PM
    I think that's the magic
  • b

    bright-gpu-74537

    06/28/2020, 2:49 PM
    yeah
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:50 PM
    okay
  • b

    bright-gpu-74537

    06/28/2020, 2:51 PM
    i think
    list.renderItem = function(data:MyData, ?cached:Component):Component { /* ... */ }
    might be something interesting to explore anyway though
  • b

    bright-gpu-74537

    06/28/2020, 2:51 PM
    sounds like a more useful version of the existing itemRendererFunction
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:53 PM
    in react it is just
    renderItem:Data->ReactElement
    but ReactElement is just data in the virtual DOM the actual "real" element is created/modified by the reconciler so it might be trickier for haxeui because it has to render the real component directly
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:54 PM
    and user has to manually handle the component lifecycle (if they decided to dispose the previous ones...)
  • b

    bright-gpu-74537

    06/28/2020, 2:55 PM
    ill add it to the list... been meaning to revise, remove, relook at these itemrenderefunction bits again anyway 😉
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:56 PM
    sure
  • c

    cool-psychiatrist-49311

    06/28/2020, 2:56 PM
    thanks!
1...296297298...1687Latest