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

# TCustomComboBox

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

TCustomComboBox - the base class from which TComboBox is derived

## Declaration

Source position: stdctrls.pp line 263

`type TCustomComboBox = class(TWinControl)`
``
`class procedure WSRegisterClass; override;` |  | WSRegisterClass - Register this Class for the current Widget Set
`protected`
`procedure CreateParams(); override;`
`procedure InitializeWnd; override;` |  | InitializeWnd - creates the underlying interface-object: calls inherited InitializeWnd then sets up several local lists and variables notably for style and size
`procedure DestroyWnd; override;` |  | DestroyWnd - finds somewhere to store locally held variables then frees lists, calls inherited DestroyWnd
`procedure DoEnter; override;` |  | DoEnter - cals inherited method then autoselects text in dropdown list if required
`procedure DoExit; override;` |  | DoExit - disables AutoSelect then calls inherited DoExit
`procedure DrawItem(); virtual;` |  | DrawItem - perform the action necessary to draw the specified indexed item at the specified position
`procedure MeasureItem(); virtual;` |  | Measure the size (Height) of an item in the drop-down list
`protected`
`class function GetControlClassDefaultSize; override;` |  | GetControlClassDefaultSize - sets its own defaults, overriding inherited values
`protected`
`procedure LMChanged(); message;` |  | LMChanged - LCL Message to signify that the control has changed
`procedure Change; virtual;` |  | Change - software emulation of OnChange event
`procedure Select; virtual;` |  | Select - software emulation of OnSelect event
`procedure DropDown; virtual;` |  | DropDown - software emulation of OnDropDown event
`procedure GetItems; virtual;` |  | GetItems - finds the list of items for the dropdown box
`procedure SetItems(); virtual;` |  | SetItems writes the strings specified in Value to the Items list
`procedure CloseUp; virtual;` |  | CloseUp - software emulation of OnCloseUp event
`procedure AdjustDropDown; virtual;` |  | AdjustDropDown - adjust the properties of the DropDown list
`function GetItemCount;` |  | GetItemCount - returns the number of items in the DropDown list
`function GetItemHeight; virtual;` |  | GetItemHeight - returns the height of the current list item
`function GetSelLength; virtual;` |  | GetSelLength - returns the length of the current selection
`function GetSelStart; virtual;` |  | GetSelStart - returns the start position of the current selection
`function GetSelText; virtual;` |  | GetSelText - returns the currently selected text string
`function GetItemIndex; virtual;` |  | GetItemIndex - returns the Index value of the current list item
`function GetMaxLength; virtual;` |  | GetMaxLength - returns the maximum length of a list item
`function IsReadOnlyStored;` |  | IsReadOnlyStored - returns True if ReadOnly status is stored
`procedure SetDropDownCount(); virtual;` |  | SetDropDownCount - writes the number of items in DropDown list to local variable
`procedure SetDroppedDown(); virtual;` |  | SetDroppedDown - writes DroppedDown status to local boolean variable
`procedure SetItemHeight(); virtual;` |  | SetItemHeight - writes height of current list item to local variable
`procedure SetItemIndex(); virtual;` |  | SetItemIndex - writes index value of current item to local variable
`procedure SetMaxLength(); virtual;` |  | SetMaxLength - writes maximum length of list item to local variable
`procedure SetSelLength(); virtual;` |  | SetSelLength - writes length of current selection to local variable
`procedure SetSelStart(); virtual;` |  | SetSelStart - writes start position of current selection to local variable
`procedure SetSelText(); virtual;` |  | SetSelText - writes currently selected text string to local variable
`procedure SetSorted(); virtual;` |  | SetSorted - writes to local (boolean) variable to show if list is Sorted
`procedure SetStyle(); virtual;` |  | SetStyle - writes the current Style specifier to local variable
`procedure RealSetText(); override;` |  | RealSetText - sets the ComboBox text to the caption value specified
`procedure KeyDown(); override;` |  | KeyDown - performs code for traversing the dropdown list to the correct location before calling inherited KeyDown
`procedure KeyUp(); override;` |  | KeyUp calls inherited method then performs specific actions depending on which key is being processed
`procedure KeyPress(); override;` |  | KeyPress adjusts character case if necessary then calls inherited method
`procedure UTF8KeyPress(); override;` |  | UTF8KeyPress converts character case if required then calls inherited method
`procedure MouseUp(); override;` |  | MouseUp calls inherited method then sets AutoSelect if left mouse button is clicked for the first time after receiving focus
`function SelectItem();` |  | SelectItem - returns True if current item (specified by a string) is to be selected
`property ItemHeight: Integer; [rw]` |  | ItemHeight - the height of the current item in the drop-down list
`property ItemWidth: Integer; [rw]` |  | ItemWidth - the width of the current item in the drop-down list
`property MaxLength: Integer; [rw]` |  | MaxLength - the maximum allowed length of a string
`property OnChange: TNotifyEvent; [rw]` |  | OnChange - event handler for any change in properties of the combo box
`property OnCloseUp: TNotifyEvent; [rw]` |  | OnCloseUp - event handler for when the drop-down box is closed up again
`property OnDrawItem: TDrawItemEvent; [rw]` |  | OnDrawItem - event handler for when an entry is written to the Items list
`property OnDropDown: TNotifyEvent; [rw]` |  | OnDropDown - event handler for when the drop-down list appears
`property OnGetItems: TNotifyEvent; [rw]` |  | Event handler when items can be populated
`property OnMeasureItem: TMeasureItemEvent; [rw]` |  | Event handler when measurement of an item is required
`property OnSelect: TNotifyEvent; [rw]` |  | Event handler when an item or some text is selected
`property ParentColor;` |  | ParentColor - should the control have the same colour as the parent? Default is true
`property Sorted: Boolean; [rw]` |  | Sorted - whether the entries in the drop-down list have been sorted
`public`
`constructor Create(); override;` |  | Create - constructor for TCustomComboBox: calls inherited Create then initialises styles, item lists, bounds and various other local variables
`destructor Destroy; override;` |  | Destroy - destructor for TCustomComboBox: frees handles, itemlists, canvas and items then calls inherited Destroy
`procedure IntfGetItems;` |  | IntfGetItems - gets list of items from the interface
`procedure AddItem();` |  | AddItem - adds an Item to the list in the drop-down box
`procedure AddHistoryItem();` |  | AddHistoryItem - Add an Item as first entry in History List
`procedure Clear; virtual;` |  | Clear - remove all text and drop-down list
`procedure ClearSelection;` |  | ClearSelection - clear the currently selected text or items from drop-down list
`property CharCase: TEditCharCase; [rw]` |  | CharCase: indicates whether text is to be displayed as Upper, Lower or Normal case (as entered)
`property DroppedDown: Boolean; [rw]` |  | DroppedDown - indicates whether or not the drop-down list has appeared
`procedure SelectAll;` |  | Select all items in the list
`property AutoComplete: Boolean; [rw]` |  | AutoComplete - enables the facility to offer suggestions for completing text-strings
`property AutoCompleteText: TComboBoxAutoCompleteText; [rw]` |  | AutoCompleteText : Options for behavior of the Auto-Complete feature
`property AutoDropDown: Boolean; [rw]` |  | AutoDropDown - if True, the drop-down list appears as soon as the cursor moves over the text box
`property AutoSelect: Boolean; [rw]` |  | AutoSelect : Boolean. If True, all contents of Text box are selected when control receives focus
`property AutoSelected: Boolean; [rw]` |  | AutoSelected : True indicates that the combobox control has just performed an AutoSelect operation
`property AutoSize;` |  | AutoSize defaults to True, overriding any previous default
`property ArrowKeysTraverseList: Boolean; [rw]` |  | ArrowKeysTraverseList - enables the operator to use the keyboard Arrow keys to move through the list as an alternative to using the mouse
`property Canvas: TCanvas; [r]` |  | Canvas - the area on which the components are drawn or painted
`property DropDownCount: Integer; [rw]` |  | DropDownCount - number of entries in the drop-down list
`property Items: TStrings; [rw]` |  | Items - an array of strings that holds the entries of the drop-down list
`property ItemIndex: Integer; [rw]` |  | Index - the number of the currently selected item (starting at zero)
`property ReadOnly: Boolean; [rws]` |  | ReadOnly - if True, information in the control can only be Read, not Written or Deleted
`property SelLength: Integer; [rw]` |  | SelLength - the length of the text that has been selected in bytes
`property SelStart: Integer; [rw]` |  | SelStart - if text is selected this is the starting position otherwise the cursor position in bytes starting at 0
`property SelText: String; [rw]` |  | SelText - the text string that has been selected for editing
`property Style: TComboBoxStyle; [rw]` |  | Style : may be Simple, a single-line Drop-Down or a Drop-Down list, or some version drawn by the Owner
`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
`end;`

## Inheritance

`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

TCustomComboBox - the base class from which TComboBox is derived

Despite similarities in appearance to TCustomEdit and TCustomList , the class inherits no properties from these classes, but only from TWinControl

It has some interesting properties including AutoComplete and AutoCompleteText, AutoDropDown and the ability to create and add a History display

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