1. Computing
Send to a Friend via Email

TComboBox - Delphi Usage Examples, Tips and Tricks

Delphi's TComboBox displays a drop down collection of items in a scrollable list that users can select and edit. Users can select an item from the list or type directly into the edit box. Learn how to use the drop down box control in Delphi programs.

Sizing The ComboBox Drop Down Width - No Cut Off For Right Edge Placements
When a combo box is in dropped down state Windows draws a list box type of control to display combo box items for selection. When the length (of a string) of items exceeds the width of the combobox, the items are displayed as cut-off! Here's how to ensure all ComboBox items are visible when drop down list is displayed.

Drawing a TComboBox: Color Pick List, Font Pick List
Graphical Drop Down List - a Combo Box of Colors; and a True-Type Font Picker.

Implementing OnMouseOver for Items in a TComboBox, with Custom Hints
Here's how to get the caption of an item in a TComboBox as mouse hovers over an item when the ComboBox is in drop down state. Use this "trick" to get the object associated with the "pre-selected" item in a combo box, or to display a custom hint for each item, for example.

Store a String (or an Object) Along with a String in Combo Box
There are situations when you want to display a list of strings to the user, for example in the list box control, but also have a way to store one more additional string along the one displayed to the user.

How to Right Align Items in a TComboBox
Suppose you have a ComboBox displaying currency values, or more generally numbers. Here's how to display the items in a ComboBox right-aligned...

How to complete partial strings typed into a combo box
The example shows how to complete partial strings typed into a combo box. The code represents the OnKeyPress event handler of the combo box, which performs most of the default keystroke handling before finding matching list item and updating the text.

©2014 About.com. All rights reserved.