[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'StdCtrls' (#lcl)

# TComboBox

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TComboBox - a simple combination of text box for free text entry, and a drop-down list allowing one of several options to be chosen.

## Declaration

Source position: stdctrls.pp line 407

`type TComboBox = class(TCustomComboBox)`
`published`
`property Align;` |  | Used to align the control to the top, bottom, left or right of its client.
`property Anchors;` |  | The set of anchor definitions for this control
`property ArrowKeysTraverseList;` |  | ArrowKeysTraverseList - enables the operator to use the keyboard Arrow keys to move through the list as an alternative to using the mouse
`property AutoComplete;` |  | AutoComplete - enables the facility to offer suggestions for completing text-strings
`property AutoCompleteText;` |  | AutoCompleteText : Options for behavior of the Auto-Complete feature
`property AutoDropDown;` |  | AutoDropDown - if True, the drop-down list appears as soon as the cursor moves over the text box
`property AutoSelect;` |  | AutoSelect : Boolean. If True, all contents of Text box are selected when control receives focus
`property AutoSize;` |  | Whether auto-size is to be used
`property BidiMode;` |  | BiDiMode - enabling bi-directional writing
`property BorderSpacing;` |  | Determines the border spacing for this control
`property CharCase;` |  | CharCase: indicates whether text is to be displayed as Upper, Lower or Normal case (as entered)
`property Color;` |  | Determine the colour for the current control
`property Constraints;` |  | Determine Constraints (max and min height and width) for this control
`property DragCursor;` |  | DragCursor - the style of cursor to be used during the Drag process
`property DragKind;`
`property DragMode;` |  | DragMode - whether manual or automatic
`property DropDownCount;` |  | DropDownCount - number of entries in the drop-down list
`property Enabled;` |  | Whether the control is Enabled (read/write). If not, it usually appears 'greyed-out'
`property Font;` |  | The font to be used for text in this control (read/write).
`property ItemHeight;` |  | ItemHeight - the height of the current item in the drop-down list
`property ItemIndex;` |  | Index - the number of the currently selected item (starting at zero)
`property Items;` |  | Items - an array of strings that holds the entries of the drop-down list
`property ItemWidth;` |  | ItemWidth - the width of the current item in the drop-down list
`property MaxLength;` |  | MaxLength - the maximum allowed length of a string
`property OnChange;` |  | OnChange - event handler for any change in properties of the combo box
`property OnChangeBounds;` |  | Event handler for a change in bounds of the control
`property OnClick;` |  | Event Handler for mouse click
`property OnCloseUp;` |  | OnCloseUp - event handler for when the drop-down box is closed up again
`property OnContextPopup;` |  | Event handler to supply information when a context-sensitive pop-up menu is required
`property OnDblClick;` |  | Event Handle for mouse double-click
`property OnDragDrop;` |  | Event handler for the drop of a control onto this control.
`property OnDragOver;` |  | Event handler for the case when a control is dragged over another control
`property OnDrawItem;` |  | OnDrawItem - event handler for when an entry is written to the Items list
`property OnEndDrag;` |  | Event handler for the end of a dragging process
`property OnDropDown;` |  |
`property OnEditingDone;` |  | Event handler when editing is done
`property OnEnter;` |  | OnEnter - event handler for when the mouse enters the control, and the control receives focus
`property OnExit;` |  | OnExit - event handler for when the mouse leaves the control and it loses focus
`property OnGetItems;` |  | OnGetItems - event handler for getting list of items for dropdown box
`property OnKeyDown;` |  | OnKeyDown - event handler for instance when key is down while control has focus
`property OnKeyPress;` |  | OnKeyPress - event controller for a key being pressed while the control has focus. To properly handle national chars use UTF8KeyPress instead.
`property OnKeyUp;` |  | OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus
`property OnMeasureItem;` |  | Event handler when measurement of an item is required
`property OnMouseDown;` |  | Event handler for when a mouse button is pressed down
`property OnMouseEnter;`
`property OnMouseLeave;`
`property OnMouseMove;` |  | Event handler for mouse movement within the current control
`property OnMouseUp;` |  | Event handler for when the mouse button is released, ie "up"
`property OnStartDrag;` |  | Event handler for start of dragging operation
`property OnSelect;` |  | Event handler when an item or some text is selected
`property OnUTF8KeyPress;` |  | UTF8KeyPress - event controller for a key being pressed while the control has focus.
`property ParentBidiMode;` |  | ParentBiDiMode - does the control follow the BiDiMode settings of its parent?
`property ParentColor;` |  | ParentColor - should the control have the same colour as the parent? Default is true
`property ParentFont;` |  | ParentFont - should the control use the same font as the parent? Default is true
`property ParentShowHint;` |  | ParentShowHint - does the control adopt the same hinting behaviour as its parent? Default is true
`property PopupMenu;` |  | PopupMenu - a context-sensitive menu that pops up when the right mouse button is clicked over this control
`property ReadOnly;` |  | ReadOnly - if True, information in the control can only be Read, not Written or Deleted
`property ShowHint;` |  | Flag to determine: Is hint to be displayed for this control?
`property Sorted;` |  | Sorted - whether the entries in the drop-down list have been sorted
`property Style;` |  | Style : may be Simple, a single-line Drop-Down or a Drop-Down list, or some version drawn by the Owner
`property TabOrder;` |  | The place this control occupies in the list of tabs
`property TabStop;` |  | Is the control in the sequence of controls accessed by successive presses of the Tab key?
`property Text;` |  | Text - the string appearing in the main box. If an item on the drop-down list is selected, it replaces the contents of Text
`property Visible;` |  | Visible - can the control be seen?
`end;`

## Inheritance

`TComboBox` |  | TComboBox - a simple combination of text box for free text entry, and a drop-down list allowing one of several options to be chosen.
`TCustomComboBox` |  | TCustomComboBox - the base class from which TComboBox is derived
`TWinControl`
`TControl`
`TLCLComponent` |  | TLCLComponent - base class for LCL components
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent`
`TObject`

## Description

TComboBox - a simple combination of text box for free text entry, and a drop-down list allowing one of several options to be chosen.

The default text-string (if any, entered in the Form Designer) and the value of the text string that is ultimately selected from the drop-down list, is held in Text

The values that can be selected from the drop-down list are held in the string-array Items. Clicking on the ellipsis (...) next to Items in the Object Inspector opens a pop-up string-list editor which allows the designer to enter and edit a number of lines of text to represent the selections

At run-time, the entry selected from the drop-down list in Items is used to replace any information previously found in Text, and ItemIndex holds the (zero-origin) index number of the selected item

If no value is selected from the drop-down list, the default text (if any) remains, or any information typed directly into Text will be returned, and ItemIndex takes the value of -1

## See also

HowToUseStdCtrls |  | How to use StdCtrls, ComCtrls or ExtCtrls

The latest version of this document can be found at lazarus-ccr.sourceforge.net.