From Dabo Wiki
Jump to: navigation, search

This control allows the user to select one item from a pre-set list of items. It normally appears as a single line displaying the selected item, along with an arrow button which the user clicks to "drop down" the full list. When a selection is made from that list, the list disappears, leaving the single-line control. Because its full list isn't displayed until the user selects it, it is ideal for presenting a selection without taking up a lot of area on the screen.

Some of the more useful properties:

  • Choices (list): This determines the options available for the control. You can only get/set this, not append.
  • Keys (dict / list / tuple): Value that is associated with the Choices. Many times you want to present the user with a list of choices that mean something to them, but internally in your program, you really need the ID or primary key or some other identifying value that is associated with the choice that the user made. The easiest way to set up the Keys property is to make it a 1:1 list of values that correspond position-wise to the Choices list. This way, when the user selects, say, the third choice in the list, KeyValue will return the third value in the Keys list.
  • StringValue (str): Returns the text displayed by the control for the selected item.
  • PositionValue (int): Returns the position of the selected item in the list of available Choices.
  • KeyValue (varies): Returns the value in Keys that corresponds to 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.

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).