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

TCustomComboBox

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

The base class for ComboBox components.

Declaration

Source position: stdctrls.pp line 263

type TCustomComboBox = class(TWinControl) end;

protected

  class procedure WSRegisterClass; override;

  

Registers this component class with the current WidgetSet.

  procedure CreateParams(); override;

  procedure InitializeWnd; override;

  procedure DestroyWnd; override;

  procedure DoEnter; override;

  

Selects the entire text when AutoSelect is True.

  procedure DoExit; override;

  

Clears AutoSelect, then calls inherited DoExit

  procedure DrawItem(); virtual;

  

Draws an item, using the OnDrawItem handler if one is installed.

  procedure KeyUpAfterInterface(); override;

  procedure MeasureItem(); virtual;

  

Invokes the OnMeasureItem handler, to get the height of the item in the drop-down list.

  class function GetControlClassDefaultSize; override;

  procedure LMChanged(); message;

  

Notification of a change in the edit box.

  procedure CMWantSpecialKey(); message;

  procedure Change; virtual;

  

Invokes the OnChange handler, signaling an change in the edit box.

  procedure Select; virtual;

  

Invokes the OnSelect handler.

  procedure DropDown; virtual;

  

Invokes the OnDropDown handler.

  procedure GetItems; virtual;

  

Invokes the OnGetItems handler.

  procedure SetItems(); virtual;

  procedure CloseUp; virtual;

  

Called whenever the list hides.

  procedure AdjustDropDown; virtual;

  

Adjusts the extent of the DropDown list.

  procedure DoAutoAdjustLayout(); override;

  function GetItemCount;

  

Returns the number of list items.

  function GetItemHeight; virtual;

  function GetSelLength; virtual;

  function GetSelStart; virtual;

  function GetSelText; virtual;

  function GetItemIndex; virtual;

  function GetMaxLength; virtual;

  function IsReadOnlyStored;

  procedure SetDropDownCount(); virtual;

  procedure SetDroppedDown(); virtual;

  procedure SetItemHeight(); virtual;

  procedure SetItemIndex(); virtual;

  procedure SetMaxLength(); virtual;

  procedure SetSelLength(); virtual;

  procedure SetSelStart(); virtual;

  procedure SetSelText(); virtual;

  procedure SetSorted(); virtual;

  procedure SetStyle(); virtual;

  procedure RealSetText(); override;

  

Adjusts ItemIndex according to the new edit box content.

  procedure KeyDown(); override;

  

Filters TAB and RETURN key when used to traverse the list.

  procedure KeyUp(); override;

  

Invokes the OnKeyUp handler.

  procedure UTF8KeyPress(); override;

  

UTF8KeyPress converts character case if required then calls inherited method

  procedure MouseUp(); override;

  

AutoSelect when left mouse is clicked for the 1st time after having focus.

  function SelectItem();

  

Selects the item with the given text.

  procedure ShouldAutoAdjust(); override;

  property ItemHeight: Integer; [rw]

  

The default height of a list item.

  property ItemWidth: Integer; [rw]

  

The minimum width of the items in the drop-down list.

  property MaxLength: Integer; [rw]

  

The maximum length of user input.

  property OnChange: TNotifyEvent; [rw]

  

Event handler for user changed text in the edit box.

  property OnCloseUp: TNotifyEvent; [rw]

  

Handler invoked when the drop-down list closes.

  property OnDrawItem: TDrawItemEvent; [rw]

  

Handler for special painting of an item (in owner-draw mode).

  property OnDropDown: TNotifyEvent; [rw]

  

Handler invoked when the list has dropped down.

  property OnGetItems: TNotifyEvent; [rw]

  

Handler invoked when widgetset items list can be populated

  property OnMeasureItem: TMeasureItemEvent; [rw]

  

Handler invoked when the height of an item is required.

  property OnSelect: TNotifyEvent; [rw]

  

Handler invoked when an item is selected.

  property ParentColor: Boolean;

  

If true, the Color of the control will be the same as the one from the Parent. Default is true.

  property Sorted: Boolean; [rw]

  

Determines whether the list entries are sorted.

public

  constructor Create(); override;

  destructor Destroy; override;

  procedure IntfGetItems;

  

Called whenever the items can be just-in-time populated.

  procedure AddItem(); virtual;

  

Adds an item to the Items list.

  procedure AddHistoryItem();

  

Add an item as the first entry in History List.

  procedure Clear; virtual;

  

Removes all items from the list, clears the edit box.

  procedure ClearSelection;

  

Unselect a possibly selected item (ItemIndex becomes -1).

  property CharCase: TEditCharCase; [rw]

  

Indicates how text is converted during input (upper, lower, or as entered).

  property DroppedDown: Boolean; [rw]

  

Indicates whether the drop-down list has appeared.

  property DroppingDown: Boolean; [rw]

  procedure SelectAll;

  

Select the entire text in the edit box.

  property AutoComplete: Boolean; [rw]

  

Allows to select items from partial input, of the begin of the item text.

  property AutoCompleteText: TComboBoxAutoCompleteText; [rw]

  

Options for the behavior of the Auto-Complete feature.

  property AutoDropDown: Boolean; [rw]

  

Makes the drop-down list appear as soon as the user starts entering text.

  property AutoSelect: Boolean; [rw]

  

Selects the entire content of the edit box when the control receives the focus.

  property AutoSelected: Boolean; [rw]

  

True indicates that the selection was marked automatically by the control.

  property AutoSize: Boolean;

  

TCustomComboBox default is True

  property ArrowKeysTraverseList: Boolean; [rw]

  

Allows the operator to use also the keyboard Arrow keys to move through the list.

  property Canvas: TCanvas; [r]

  property DropDownCount: Integer; [rw]

  

The height of the drop-down list, measured in number of items.

  property Items: TStrings; [rw]

  

The list of all items in the control.

  property ItemIndex: Integer; [rw]

  

The index of the currently selected item, -1 if none is selected.

  property ReadOnly: Boolean; [rws]

  

Disallows entry of free text.

  property SelLength: Integer; [rw]

  

The number of selected UTF-8 characters in the edit box.

  property SelStart: Integer; [rw]

  

The zero-based UTF-8 index of the begin of the selection in the edit box.

  property SelText: string; [rw]

  

The selected text in the edit box.

  property Style: TComboBoxStyle; [rw]

  

Appearance and behaviour of the ComboBox (static/drop-down, owner-draw...).

  property TabStop: Boolean;

  

Allows the user to navigate to this control, by pressing the Tab key.

  property Text: TCaption;

  

The string appearing in the edit box.

Inheritance

TCustomComboBox

  

The base class for ComboBox components.

|

TWinControl

  

The base class for controls which can contain other (child) controls.

|

TControl

  

The base class for visible controls.

|

TLCLComponent

  

The base class for LCL components associated with widgets.

|

TComponent

?

TObject

Description

A ComboBox combines an edit box with an item list. The list can be either static (always visible), or drops down when needed.

Depending on the ComboBox Style the user can type text into the edit box, or he can select items from the Items list.

Despite similarities in appearance to TCustomEdit and TCustomList, the class inherits no properties from these classes (Delphi compatible).

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.