Hello,
earlyer i’ve feel the need to have the ability with RadioButtonGroup to remove the toggle of a Button and since i couldn’t find a way i’ve added some line on the core, if someone can review them it would be nice
i’m pretty new to this… i didn’t managed to build the source and test this out so i don’t know if it work but the idea is there so if someone can manage to make this work it will be a lot of help for me and if it could be added to the core that’s even better
[java]
/**
* Sets the current selected Radio Button to the Button associated with the provided index
* @param index
*/
public void setSelected(int index) {
if (this.selectedIndex != index && index != -1) {
if (index >= 0 && index < radioButtons.size()) {
Button rb = radioButtons.get(index);
this.selected = rb;
this.selectedIndex = index;
for (Button rb2 : radioButtons) {
if (rb2 != this.selected)
rb2.setIsToggled(false);
else
rb2.setIsToggled(true);
}
onSelect(selectedIndex, rb);
} else if (index == -1){
this.selected = null;
this.selectedIndex = -1;
for (Button rb2 : radioButtons) {
rb2.setIsToggled(false);
}
}
}
}
/**
* Sets the current selected Radio Button to the Button instance provided
* @param button
*/
public void setSelected(Button button) {
if (this.selected != button && button != null) {
this.selected = button;
this.selectedIndex = radioButtons.indexOf(button);
for (Button rb : radioButtons) {
if (rb != this.selected) {
if (rb.getIsToggled()){
rb.setIsToggled(false);
} else {
rb.setIsToggled(true);
}
}
}
onSelect(selectedIndex, button);
} else if (button == null){
this.selected = null;
this.selectedIndex = -1;
for (Button rb2 : radioButtons) {
rb2.setIsToggled(false);
}
}
} [/java]
Thx.