A row-column widget containing several toggle-button widgets (CwToggleButton) can be configured to have radio-button behavior.When a button is selected in this mode, any other selected buttons in the group are automatically deselected, leaving only one button selected at any time. The radioBehavior resource of the CwRowColumn widget controls this behavior.Create a CwRowColumn with radioBehaviour set to true using the convenience method createRadioBox:argBlock:.As a side effect of createRadioBox:argBlock:, the CwRowColumn isHomogeneous resource is set to true. Children of a homogeneous row-column widget must all be of the same type. In this case, they must all be CwToggleButton widgets.You can select or deselect a toggle button using the setState:notify: method. Its state can be queried using the getState method. The valueChanged callback of a toggle button is run whenever the state of the button changes.The valueChanged callback is run when a button is deselected as well as when it is selected. The state of the widget should be checked in the callback using the getState method, or by checking the set field of the callback data.The valueChanged callback used by the code is shown below. The selected language is indicated by the clientData argument. A message is written to the transcript whenever a new language is chosen.
|