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

    bright-gpu-74537

    02/02/2020, 8:57 PM
    they dont have to if you are using from code... but if you plan on using from xml, then they need either no constructor params, or defaults
  • b

    bright-gpu-74537

    02/02/2020, 8:58 PM
    and yeah,
    Dialog
    is the way to go
  • b

    bright-gpu-74537

    02/02/2020, 8:59 PM
    this might help: https://github.com/haxeui/component-examples/tree/master/dialogs
  • t

    thousands-house-41767

    02/03/2020, 11:49 AM
    Yeah it wasn't so complicated to be honest once I thought about the Dialog class :)
  • u

    user

    02/03/2020, 3:04 PM
    @User If I create a dropdown from code, could I just create a DataSource and define the dropdown datasource to be the one I created and the dropdown should handle it (i.e. transform the string to a item-renderer containing a label)? Or do I have to define the ItemRenderer of the dropdown ?
  • u

    user

    02/03/2020, 3:06 PM
    If its the latter there is no way right now to access the handler. If its the former it doesnt seem to work. (haxeui-kha as always)
  • b

    bright-gpu-74537

    02/03/2020, 3:08 PM
    You shouldnt have to define the item renderer, it comes with a default... data source should be enough, can you paste some code so i can understand fully what you mean?
  • u

    user

    02/03/2020, 3:08 PM
    Copy code
    var dropdown = new DropDown();
            var data:DataSource<String> = new DataSource<String>();
            data.add("All");
  • u

    user

    02/03/2020, 3:08 PM
    dropdown.dataSource = data;
  • b

    bright-gpu-74537

    02/03/2020, 3:16 PM
    well, you need an actual data source impl
  • b

    bright-gpu-74537

    02/03/2020, 3:17 PM
    either
    ArrayDataSource
    or
    ListDataSource
  • b

    bright-gpu-74537

    02/03/2020, 3:17 PM
    ie:
  • b

    bright-gpu-74537

    02/03/2020, 3:17 PM
    Copy code
    haxe
    var ds = new ArrayDataSource<String>();
    ds.add("all");
    dropdown.dataSource = ds
  • u

    user

    02/03/2020, 3:18 PM
    Oh. I cant justb use datasource
  • u

    user

    02/03/2020, 3:18 PM
    didnt know
  • b

    bright-gpu-74537

    02/03/2020, 3:18 PM
    nope, its a base class
  • b

    bright-gpu-74537

    02/03/2020, 3:18 PM
    if you did:
  • u

    user

    02/03/2020, 3:18 PM
    btw do itemrenderers need a parent in the xml markup ?
  • u

    user

    02/03/2020, 3:18 PM
    I pulled most recent and I get some errors in macro builder
  • b

    bright-gpu-74537

    02/03/2020, 3:19 PM
    dropdpwn.dataSource.add("bob")
    it would have worked also, as it creates an instance... arraydatasource i think
  • u

    user

    02/03/2020, 3:19 PM
    nope; says cannot call property add of null
  • u

    user

    02/03/2020, 3:19 PM
    since datasource is null until we new it(from what I tested anyways)
  • b

    bright-gpu-74537

    02/03/2020, 3:20 PM
    oh... so i lied then... it doesnt create an instance 😄
  • u

    user

    02/03/2020, 3:21 PM
    btw do itemrenderers need a parent in the xml markup ? I pulled most recent and I get some errors in macro builder
  • u

    user

    02/03/2020, 3:21 PM
    when building itemrenderers with the macro
  • b

    bright-gpu-74537

    02/03/2020, 3:21 PM
    can you paste a simple non working example?
  • u

    user

    02/03/2020, 3:21 PM
    Copy code
    projectslist.itemRenderer =  haxe.ui.macros.ComponentMacros.buildComponent(
                "../Assets/custom/projectlist-items.xml");
  • u

    user

    02/03/2020, 3:22 PM
    markup:
    Copy code
    <item-renderer id="paths" width="100%" >
        <vbox>
            <label id="name" width="100%" />
            <label id="path" width="100%" />
        </vbox>
    </item-renderer>
  • b

    bright-gpu-74537

    02/03/2020, 3:22 PM
    hmmm, i guess that should have worked... did it used to work previously?
  • u

    user

    02/03/2020, 3:22 PM
    yes;
1...174175176...1687Latest