DRadioList

From Dabo Wiki
Jump to: navigation, 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 Keys list 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, or Key. Determines the result returned by accessing the Value property: either StringValue, PositionValue or KeyValue. You can always refer to any of those different value types, but when you know which value your program will be needing, you can set ValueMode, and afterwards just have the normal Value binding 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 _dRadioButton class is used, but if you have specific needs, you can subclass _dRadioButton and 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 Caption corresponds 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 Caption corresponds 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).