This control allows the user to select one item from a pre-set list of items, or optionally type in an item that it not in the list. It is similar to dDropdownList, except that this control contains an editable textbox for user-entered information.
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:
- AppendOnEnter - (bool): When this is
True, any item the user types into the textbox is automatically appended to the list of
Choiceswhen they press the
Enterkey. There are two hook methods:
afterAppendOnEnter(). These get automatically called before and after the new item is appended to the
beforeAppendOnEnter()method gives you a chance to manipulate the user-entered value, and optionally prohibit the addition by returning
Falsefrom the method. The
afterAppendOnEnter()method gives you a chance to do post-processing.
- Choices - (list): This determines the options available for the control.
- 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
Keysproperty is to make it a 1:1 list of values that correspond position-wise to the
Choiceslist. This way, when the user selects, say, the third choice in the list,
KeyValuewill return the third value in the
- 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
- KeyValue - (varies): Returns the value in
Keysthat corresponds to the selected item.
- UserValue - (str): Represents the text typed in by the user.
UserValuecan differ from
StringValue, which would mean that the user has typed in arbitrary text. Unlike
UserValuedoes not change the currently selected item in the list portion of dComboBox.
- ValueMode (str): Can be one of
Key. Determines the result returned by accessing the
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
Valuebinding 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).