Vcl.StdCtrls.TCustomListBox

From RAD Studio API Documentation
Jump to: navigation, search

Vcl.Controls.TCustomMultiSelectListControlVcl.Controls.TCustomListControlVcl.Controls.TWinControlVcl.Controls.TControlSystem.Classes.TComponentSystem.Classes.TPersistentTCustomListBox

Delphi

TCustomListBox = class(TCustomMultiSelectListControl)

C++

class PASCALIMPLEMENTATION TCustomListBox : public Vcl::Controls::TCustomMultiSelectListControl

Properties

Type Visibility Source Unit Parent
class public
Vcl.StdCtrls.pas
Vcl.StdCtrls.hpp
Vcl.StdCtrls Vcl.StdCtrls

Description

TCustomListBox is the base class for listbox objects that are wrappers for list box controls.

TCustomListBox encapsulates behavior common to all list box controls. List box objects are used to display a scrollable list from which users can select one or more items. Use a list box control to limit the user to selecting from a list of items. Items can be added at design time or at runtime.

As a wrapper for a list box TCustomListBox introduces methods for:

Displaying, sorting, selecting, manipulating, and querying items in the list.

Creating owner-draw style list boxes that can display graphical images such as icons and bitmaps.

Creating multiple-column and multiple-selection lists.

By default, TCustomListBox is a standard list box that displays items as text strings. These items are contained in a TStrings object, and the methods of the TStrings object are used to add, insert or delete a string. The following code demonstrates adding a new string to the list box:

MyListBox.Items.Add('New item'); //Delphi

MyListBox->Items->Add("New item"); // C++

Descendants of TCustomListBox inherit the basic functionality of TCustomListBox. Some descendants also have specialized behavior and can be linked to file, directory, drive, or database information. Use these list boxes to easily access and list this type of information.

A combo box is a list box with an edit control and an optional drop down style for the list. Use a combo box to allow users to type their selection into an edit box or to save space on a form by having the list drop down.

For lists of items that require a matrix or expandable tree-like structure, use list views or tree views. These controls allow the grouping of items under column headings or in expandable and contractible rows.

See Also