SWT: set radio buttons programmatically -
when create couple of radio buttons (new button(parent, swt.radio)
) , set selection programmatically using radiobutton5.setselection(true)
selected radio button remains selected. have iterate on other radio buttons of same group unselect them or there simpler alternative? in advance.
unfortunately, have iterate on options. first time when ui comes bn_clicked
event fired. if shell
or group
or whatever container of radio buttons not created swt.no_radio_group
option following method called:
void selectradio () { control [] children = parent._getchildren (); (int i=0; i<children.length; i++) { control child = children [i]; if (this != child) child.setradioselection (false); } setselection (true); }
so eclipse depends on iterating on radio buttons , toggling state.
every time manually select radio button bn_clicked
event fired , hence auto toggling.
when use button.setselection(boolean)
no bn_clicked
event fired. therefore no automatic toggling of radio buttons.
check org.eclipse.swt.widgets.button
class more details.
Comments
Post a Comment