Haxeui-openfl DropDown error

I’m using

  • haxeui-openfl 1.0.0
  • haxeui-core 1.0.11
  • Haxe 3.4.4

Just wondering how to add items to the DropDown programatically, this is my code:

    // Main.hx
    Toolkit.init();
    var dd = new DropDown(); // line 86
    var data = new DataSource<Dynamic>();
    data.add("adsadsds");
    data.add("adsadsds");
    data.add("adsadsds");
    data.add("adsadsds");
    dd.dataSource = data;
    addChild(dd);

Running it in neko gives the following error stack trace:

Called from ? line 1
Called from ApplicationMain.hx line 25
Called from ApplicationMain.hx line 130
Called from lime/app/Application.hx line 150
Called from lime/_internal/backend/native/NativeApplication.hx line 146
Called from lime/_internal/backend/native/NativeApplication.hx line 175
Called from lime/_internal/macros/EventMacro.hx line 91
Called from lime/system/ThreadPool.hx line 199
Called from lime/_internal/macros/EventMacro.hx line 91
Called from lime/_internal/backend/native/NativeHTTPRequest.hx line 451
Called from lime/app/Promise.hx line 108
Called from lime/net/HTTPRequest.hx line 112
Called from lime/app/Promise.hx line 108
Called from lime/app/Future.hx line 284
Called from lime/app/Future.hx line 129
Called from lime/app/Promise.hx line 108
Called from lime/utils/Assets.hx line 475
Called from lime/app/Promise.hx line 126
Called from lime/app/Future.hx line 129
Called from lime/app/Promise.hx line 108
Called from lime/utils/Preloader.hx line 286
Called from lime/utils/Preloader.hx line 202
Called from lime/utils/Preloader.hx line 304
Called from lime/utils/Preloader.hx line 218
Called from lime/_internal/macros/EventMacro.hx line 91
Called from ApplicationMain.hx line 113
Called from openfl/display/Preloader.hx line 48
Called from openfl/display/DisplayObject.hx line 1136
Called from openfl/display/DisplayObject.hx line 1497
Called from openfl/display/DisplayObject.hx line 1436
Called from openfl/events/EventDispatcher.hx line 402
Called from openfl/display/Preloader.hx line 252
Called from openfl/display/Preloader.hx line 213
Called from openfl/display/DisplayObject.hx line 1136
Called from openfl/display/DisplayObject.hx line 1497
Called from openfl/display/DisplayObject.hx line 1436
Called from openfl/events/EventDispatcher.hx line 402
Called from openfl/display/Preloader.hx line 101
Called from lime/_internal/macros/EventMacro.hx line 91
Called from ApplicationMain.hx line 116
Called from ApplicationMain.hx line 155
Called from openfl/display/Stage.hx line 1440
Called from E:\HaxeToolkit\haxe\std/neko/Lib.hx line 65
Called from ApplicationMain.hx line 196
Called from ApplicationMain.hx line 268
Called from ApplicationMain.hx line 286
Called from Main.hx line 86
Called from haxe/ui/components/DropDown.hx line 19
Called from haxe/ui/components/DropDown.hx line 19
Called from haxe/ui/components/Button.hx line 49
Called from haxe/ui/core/InteractiveComponent.hx line 13
Called from haxe/ui/core/Component.hx line 66
Called from haxe/ui/core/Component.hx line 87
Called from haxe/ui/components/DropDown.hx line 422
Called from haxe/ui/macros/Macros.hx line 323
Called from haxe/ui/behaviours/Behaviours.hx line 181
Called from haxe/ui/components/DropDown.hx line 74
Called from haxe/ui/components/DropDown.hx line 201
Uncaught exception - Invalid field access : dispatch

Any ideas?

what if you use new ArrayDataSource<String> or new ListDataSource<String> ?

The exception actually occurs at the constructor of the DropDown, not sure why I posted the rest of the code.

I tried this:

class Main extends Sprite {
    public function new() {
        super();
        Toolkit.init();    
        var dd = new DropDown(); // line 86
        var data = new ArrayDataSource<Dynamic>();
        data.add("adsadsds");
        data.add("adsadsds");
        data.add("adsadsds");
        data.add("adsadsds");
        dd.text = "Dropdown";
        dd.dataSource = data;
        addChild(dd);
    }
}

And it seems to work fine (neko, hxcpp, html5):

Any more info you could give us? Do other openfl targets work?

Cheers,
Ian

Hmm, all targets except neko actually seem to work fine, thankfully (although I usually stick to neko for the convenient stack traces).

…and I just updated to haxe 4.0.3 and it all works perfectly now!

Thanks for your time and the awesome UI library :smiley:

1 Like