haxeui / haxeui-core

The core library of the HaxeUI framework
http://haxeui.org
MIT License
346 stars 72 forks source link

[new-component-method] optionbox issue, several selected items in one group #275

Closed Helgiii closed 4 years ago

Helgiii commented 5 years ago

here's a sample code, paste it into Main.hx constructor, default haxe-openfl proj template:

Toolkit.init();

var abs:Absolute = new Absolute(); Screen.instance.addComponent(abs);

//option boxes var vbox:VBox = new VBox(); vbox.x = 10; vbox.y = 10; abs.addComponent(vbox);

//add 3 optionboxes, all 3 get selected despite the fact they are in 1 group var opt:OptionBox; for (i in 0...3) { opt = new OptionBox(); opt.id = opt.text = "opt" + Std.string(i+1); opt.componentGroup = "group"; opt.selected = true; vbox.addComponent(opt);
}

ianharrigan commented 5 years ago

This was a good one, there is a partial fix here: https://github.com/haxeui/haxeui-core/commit/9f9a9843dc33813b0c80736dd1eaa38744397892

It was an async image issue. However, thats not the full story, now only a single option box looks selected, however, on the openfl backend (using the code above) its not always the last item (as you would expect it to be) - this only seems to be apply to the openfl backed - html seems fine (others untested). Will open a new issue and cross ref this one.