DRadioList
From Dabo Wiki
Jump to navigationJump to search
dRadioList creates a group of radio buttons, allowing mutually-exclusive choices. Similar to dDropdownList, you can use this control to present the user with multiple choices from which they may select one and only one choice. Where the dDropdownList is suitable for lists of one to a couple hundred choices, a dRadioList is really only suitable for lists of one to a dozen at most.
Some of the more useful properties for dRadioList:
- Caption - (str): The text displayed at the top of the list.
- Choices - (list of strings): Specifies the choices available to the radio list. The order of the items in the list determines their order in the control.
- Keys - (list): Key values that correspond to the
Choices. - KeyValue - (varies): Element of the
Keyslist that corresponds to the selected item. - PositionValue - (int): Index of the selected item.
- StringValue - (str): Text of the selected item.
- ValueMode (str): Can be one of
String,Position, orKey. Determines the result returned by accessing theValueproperty: eitherStringValue,PositionValueorKeyValue. You can always refer to any of those different value types, but when you know which value your program will be needing, you can setValueMode, and afterwards just have the normalValuebinding work correctly. - ShowBox - (bool): Determines whether the surrounding box is drawn.
- Orientation - (str): Controls the arrangement of the items. Either
"Vertical"(default) or"Horizontal". - ButtonSpacing - (int): Controls the spacing between the items in the control.
- ButtonClass - (dRadioButton): Class used for the radio buttons. Normally the standard
_dRadioButtonclass is used, but if you have specific needs, you can subclass_dRadioButtonand create your own behaviors. - SizerClass - (dSizer): Class to use to layout the control. Normally the default of dBorderSizer is what you need.
Some of the more useful methods for dRadioList:
- enable(item, val) - (None): Enables/disables the specified item. The item is dependent on the current
ValueMode. - enableKey(item, val) - (None): Enables/disables the item whose key corresponds to the passed value.
- enablePosition(item, val) - (None): Enables/disables the item whose position corresponds to the passed value.
- enableString(item, val) - (None): Enables/disables the item whose
Captioncorresponds to the passed value. - show(item, val) - (None): Shows/hides the specified item. The item is dependent on the current
ValueMode. - showKey(item, val) - (None): Shows/hides the item whose key corresponds to the passed value.
- showPosition(item, val) - (None): Shows/hides the item whose position corresponds to the passed value.
- showString(item, val) - (None): Shows/hides the item whose
Captioncorresponds to the passed value.
See the Dabo Class Documentation for an exhaustive documentation of this control's Properties, Events and Methods. (Note that this documentation is no longer live, but it's still available via the Internet Archive).