DAZ Script |
---|
DzRadioButton ( DzWidget parent ) |
DzRadioButton and DzCheckBox are both option buttons (e.g. they can be checked or unchecked). They differ in how the available choices are restricted. A DzCheckBox is used to define several choices that can all co-exist at the same time (e.g. “many of many”). While a DzRadioButton is used to provide several choices, where only one can be ultimately chosen (e.g. “one of many”).
The easiest way to implement a “one of many” type choice is to create radio buttons as children of a DzButtonGroup.
Example:
// Create a new dialog var wDlg = new DzDialog; wDlg.caption = "DzRadioButton Example"; // Create a layout for the dialog var wLyt = new DzVBoxLayout( wDlg ); wLyt.autoAdd = true; // Create a button group for the options var wOptBG = new DzVButtonGroup( wDlg ); wOptBG.columns = 1; // Create the options var wOpt1Btn = new DzRadioButton( wOptBG ); wOpt1Btn.text = "Option 1"; wOpt1Btn.checked = true; var wOpt2Btn = new DzRadioButton( wOptBG ); wOpt2Btn.text = "Option 2"; var wOpt3Btn = new DzRadioButton( wOptBG ); wOpt3Btn.text = "Option 3"; // Launch the dialog wDlg.exec();