PDA

View Full Version : Radiogroup radios in multiple lines and columns



eudoxem
17 Sep 2010, 5:44 AM
Hello,

Is there a way to set radioboxes (Radio) contained in the same radiogroup (RadioGroup) on multiple lines and columns like displayed on the "Post Icons" section of this site?

What I'm getting now is a one row horizontal/vertical alignment depending on the choosen orientation. By using layouts (ColumnLayout), only the last column is displayed.

Any help will be appreciated

sven
17 Sep 2010, 5:54 AM
Nothing like this is implemented. You can for example use an LayoutContainer with ab AbsoluteLayout and position the radios as needed.

eudoxem
20 Sep 2010, 12:39 AM
Ok and thanks for the quick reply. I read the Javadoc and search some use of AbsoluteLayout but I don't find anything. Can you please give me some sample of using this layout?

jarik_bsu
2 Jul 2014, 6:03 AM
You are going to do something like this?
49536



final RadioGroup loanRateType = new RadioGroup("loanRateType");
loanRateType.setFieldLabel(Msg.MSG.loanIs());
final RadioGroup loanRateType2 = new RadioGroup("loanRateType");
loanRateType2.setLabelSeparator("");

final Radio fixed = new Radio();
fixed.setData("value", RateType.FIXED);
fixed.setBoxLabel(Msg.MSG.fixed());
loanRateType.add(fixed);

final Radio variable = new Radio();
variable.setData("value", RateType.VARIABLE);
variable.setBoxLabel(Msg.MSG.variable());
loanRateType.add(variable);

final Radio interestOnly = new Radio();
interestOnly.setData("value", RateType.INTEREST_ONLY);
interestOnly.setBoxLabel(Msg.MSG.interestOnly());
loanRateType2.add(interestOnly);

final Radio other = new Radio();
other.setData("value", RateType.OTHER);
other.setBoxLabel(Msg.MSG.other());
loanRateType2.add(other);
leftTop.add(loanRateType, FORM_DATA);
leftTop.add(loanRateType2, FORM_DATA);

Works well.
added - I have to add the 2 change listeners and have to set false to opposed radios in this listeners to have this listeners fires well.


loanRateType.addListener(Events.Change, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent baseEvent) {
//some code
interestOnly.setValue(false);
other.setValue(false);
}
});


loanRateType2.addListener(Events.Change, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent baseEvent) {
//some code
fixed.setValue(false);
variable.setValue(false);
}
});