This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

--Using ActionGroup

Information about development with ProjX.

--Using ActionGroup

Postby Development@SIB » Thu Feb 04, 2016 11:44 am

This article is outdated - please use our new system at

If you have multiple radio/toggle buttons in your UI and have the use-case that only one button should be selected than the ActionGroup is a perfect match. The ActionGroup handles a set of radio/toggle buttons and ensures that only one button in the group is selected.

The ActionGroup has an action event that triggers notifications when the selection has been changed.
Syntax: [ Download ] [ Hide ]
UIRadioButton butHLeft = new UIRadioButton("Left");
UIRadioButton butHCenter = new UIRadioButton("Center");
UIRadioButton butHRight = new UIRadioButton("Right");
UIRadioButton butHStretch = new UIRadioButton("Stretch");
ActionGroup buttonGroup = new ActionGroup(butHLeft, butHCenter, butHRight, butHStretch);

The selected button can be changed programmatically by index
Syntax: [ Download ] [ Hide ]
buttonGroup.setSelectedIndex(1); // Choose the selected index
or by button
Syntax: [ Download ] [ Hide ]
buttonGroup.setSelectedButton(butHLeft); // Choose the selected button

Use eventAction to get notifications about selection changes:

Syntax: [ Download ] [ Hide ]
buttonGroup.eventAction().addListener(this, “doSelectionChanged”);
User avatar
Posts: 313
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation