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

    bright-gpu-74537

    08/21/2019, 8:27 PM
    right... any chance of a minimal example? Seems to work for me, but maybe were doing something different
  • l

    limited-advantage-32748

    08/21/2019, 8:27 PM
    Any chance it's the type of component I'm putting in there?
  • b

    bright-gpu-74537

    08/21/2019, 8:27 PM
    possible... hard to know without some code
  • l

    limited-advantage-32748

    08/21/2019, 8:27 PM
    I'm currently assembling an ``ArrayDataSource`` with Labels
  • l

    limited-advantage-32748

    08/21/2019, 8:28 PM
    I want to make sure this isn't me being an idiot before I commit to creating an issue xP
  • b

    bright-gpu-74537

    08/21/2019, 8:28 PM
    can you share how you are creating / populating it? Or a copy of how you are at least?
  • l

    limited-advantage-32748

    08/21/2019, 8:28 PM
    Yeah can do
  • b

    bright-gpu-74537

    08/21/2019, 8:28 PM
    Well, if it doesnt work then something is up, regardless
  • b

    bright-gpu-74537

    08/21/2019, 8:28 PM
    🙂
  • l

    limited-advantage-32748

    08/21/2019, 8:28 PM
    Copy code
    static function getPalAndColorLists()
        {
            Main.pal = new Array();
            Main.pal_neg = new Array();
            var pal_names = FileSystem.readDirectory("img/");
            pal_datasource = new ArrayDataSource();
            
            var p_id:Int = 0;
            for (a in pal_names) {
                
                //create label for dropdown
                var pal_label:Label = new Label();
                var l_text = StringTools.replace(a, ".png", "");
                l_text = StringTools.replace(l_text, ".jpg", "");
                l_text = StringTools.replace(l_text, "_", " ");
                pal_label.text = l_text;
                pal_datasource.add(pal_label);
                
                ++p_id;
            }
    }
  • l

    limited-advantage-32748

    08/21/2019, 8:29 PM
    Okay so
  • l

    limited-advantage-32748

    08/21/2019, 8:29 PM
    I get a directory list of files
  • l

    limited-advantage-32748

    08/21/2019, 8:29 PM
    I then create a temporary label
  • l

    limited-advantage-32748

    08/21/2019, 8:29 PM
    set .text to the file name
  • b

    bright-gpu-74537

    08/21/2019, 8:29 PM
    ok, so yeah, you dont need to create actual components to put into the data source
  • l

    limited-advantage-32748

    08/21/2019, 8:29 PM
    then insert into the array
  • b

    bright-gpu-74537

    08/21/2019, 8:29 PM
    just data
  • l

    limited-advantage-32748

    08/21/2019, 8:30 PM
    Just data, alright
  • b

    bright-gpu-74537

    08/21/2019, 8:30 PM
    so, in your example, something like this should work:
  • b

    bright-gpu-74537

    08/21/2019, 8:31 PM
    Copy code
    haxe
    var ds = new ArrayDataSource<String>();
    ds.add("My String");
    mydropdown.dataSource = ds;
  • b

    bright-gpu-74537

    08/21/2019, 8:31 PM
    something like that anyway
  • b

    bright-gpu-74537

    08/21/2019, 8:31 PM
    (checking now real quick)
  • l

    limited-advantage-32748

    08/21/2019, 8:31 PM
    Okay cool, let me try that
  • l

    limited-advantage-32748

    08/21/2019, 8:32 PM
    or in a second, haxelib locked out again
  • l

    limited-advantage-32748

    08/21/2019, 8:32 PM
    @bitter-family-72722 this is the error I get
  • b

    bright-gpu-74537

    08/21/2019, 8:35 PM
    this should work:
  • b

    bright-gpu-74537

    08/21/2019, 8:35 PM
    Copy code
    haxe
                var dropdown = new DropDown();
                dropdown.dataSource = new ArrayDataSource<String>();
                dropdown.dataSource.add("Bob");
                dropdown.text = "Bob";
                dropdown.onChange = function(e) {
                    trace("selected: " + dropdown.selectedItem);
                }
                main.addComponent(dropdown);
  • b

    bright-gpu-74537

    08/21/2019, 8:35 PM
    i have noticed something, but probably wont affect you, just something i noticed
  • l

    limited-advantage-32748

    08/21/2019, 8:36 PM
    So then can I request for more functionality to allow components to be in a dropdown?
  • b

    bright-gpu-74537

    08/21/2019, 8:36 PM
    you would use an item renderer for that
1...101102103...1687Latest