I can't use UIEvent.CHANGE for radio button (optionbox)

hi… please, show me an example how about use UIEvent.CHANGE for radio button. I tried but it not effect. thank you
image
image
image

can’t use UIEvent.CHANGE for radio button…

Im having some major computer difficulties at the moment, but ill take a look when i get a moment.

Ian

1 Like

thank you… let’s see it when you can…

Hi @tranvantruongjvb. If you’re able to grab the latest new-component-method branch, you’ll see there’s a new Group container. You can add OptionBoxes (or any component that dispatched UIEvent.CHANGE) to a Group container and register a single UIEvent.CHANGE event on that container. See a sample below. If this solves your issue, please mark this issue as closed.

var group:Group = new Group();
group.layout = new VerticalLayout();
group.componentGroup = "testGroup";
var radio:OptionBox = cast group.addComponent(new OptionBox());
radio.text = "Radio 1";
radio = cast group.addComponent(new OptionBox());
radio.text = "Radio 2";
group.registerEvent(UIEvent.CHANGE, (e:UIEvent) -> {
	var rad:OptionBox = cast e.target;
	trace(group.componentGroup, rad.selected, rad.text);
});

addComponent(group);
1 Like

sorry…:disappointed_relieved::disappointed_relieved:i can’t find Group() on the new-component-method…

Do you have latest haxeui-core new-component-method brach?

Its certainly there: https://github.com/haxeui/haxeui-core/blob/new-component-method/haxe/ui/containers/Group.hx

1 Like