ComponentOne True DBGrid Pro 8
Using the TDBDropDown control

The built-in drop-down combo box described in the preceding example is most useful when the allowable values are both known in advance and relatively few in number. A large ValueItems collection can be unwieldy to maintain at design time, and requires substantial coding to set up at run time. Moreover, you cannot bind the built-in combo box to a data control and have it populated automatically.

Using the techniques outlined later in this chapter, you could set up a secondary TDBGrid control to be used as a drop-down. However, if you need to display a list of values from another data source, the TDBDropDown control offers a more elegant solution, as it was designed explicitly for that purpose and can be set up entirely at design time.

To use the drop-down control, set the DropDown property of a grid column to the name of a TDBDropDown control at either design time or run time. At run time, when the user clicks the in-cell button for that column, the TDBDropDown control will appear below the grid's current cell. If the user selects an item from the drop-down control, the grid's current cell is updated.

Since the TDBDropDown control is a subset of TDBGrid, it shares many of the same properties, methods, and events. However, the following two properties are specific to the TDBDropDown control:


Not to be confused with the DataField property of a Column object, this property specifies the drop-down column used to update the associated grid column when a selection is made.


This property specifies the name of the drop-down column to be used for incremental search.

When a TDBDropDown control becomes visible, its DropDownOpen event fires. Similarly, when the user makes a selection or the control loses focus, its DropDownClose event fires.

The TDBDropDown control supports all of the DataMode settings of the TDBGrid control. However, in order to enable incremental search for unbound, application, and storage modes, you need to implement the UnboundFindData event.

For more information on the differences between TDBDropDown and TDBGrid, see TDBDropDown at Design Time.



Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback