Sign in Join
FPDoc Onlineexperiment

TCustomListBox class

In unit StdCtrls

The base class for TListBox.

Declaration

pascal
TCustomListBox = class(TWinControl)

Inheritance

  1. TCustomListBox
  2. TWinControl
  3. TControl
  4. TLCLComponent
  5. TComponent
  6. TPersistent
  7. TObject

Descends from it: TCustomCheckListBox TCustomColorListBox TCustomDBListBox TCustomFileListBox TListBox

Description

TCustomListBox is a TWinControl descendant which specifies the base class used for a list box control. A list box displays a scrollable list which allows selection of one or more of the item values.

TCustomListBox provides methods, properties, and events used to display, order, and select item values. The Items for the control can be assigned at design-time in the Lazarus IDE, or stored at run-time.

At design time, a click on the ellipsis character (...) next to the Items entry in the Object Inspector opens a string-list editor in which the individual text-strings for the list items can be entered or edited. The editor also allows the entries to be sorted alphabetically in normal or reverse order.

Owner-drawn styles are available to render icons or bitmaps along with the text for the items, or using a variable height for list items. A Canvas property is provided for owner-drawn usage. Items in the list box can be displayed in one or more columns.

Use the Styles property to enable owner-drawn styles (with either fixed or variable height list items) or the "virtual mode" where the items displayed on the control are provided by event handlers. Use the OnMeasureItem and OnDrawItem event handlers to measure and render the owner-drawn list items. Use the Canvas property when needed to implement an owner-drawn style.

Do not create instances of TCustomListBox; use the TListBox descendant.

See also

Properties

AlignpublicSpecifies the placement of the control on its Parent control.
AnchorspublicThe set of anchor definitions for this control.
BorderStylepublicLine style used for the border on the control.
CanvaspublicDrawing surface where the control is drawn.
ClickOnSelChangepublicAllows selection changes to generate a Click event.
ColumnspublicThe number of visible columns displayed on the control.
ConstraintspublicContains the minimum and maximum Width and Height for the control.
CountpublicThe number of list items defined for the scrollable list box.
ExtendedSelectpublicTrue when a contiguous range of items can be selected using Shift+Click. The default value is True.
FontpublicThe font to be used for text display in this control.
IntegralHeightpublicNot implemented: shrink the Height of the widget, so that it only shows fully visible rows.
ItemHeightpublicThe default height for an item displayed in the list.
ItemIndexpublicOrdinal position for the currently selected item, -1 if none.
ItemspublicThe list of items defined for the control.
MultiSelectpublicAllows selection of more than one item from the list.
OptionspublicContains options enabled for the list box control.
ParentColorpublicUse the Color from the Parent control, when enabled.
ParentFontpublicIndicates if the Font from the Parent control is used in the control.
ParentShowHintpublicIf True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True.
PopupMenupublicA context-sensitive menu that pops up when the right mouse button is clicked over this control.
ScrollWidthpublicThe virtual width of the list box, in pixels.
SelCountpublicThe number of selected items in the list box control.
SelectedpublicThe Selected state for an item in the control.
ShowHintpublicEnables Hint display for the control.
SortedpublicDetermines whether the list entries are sorted in alphanumeric order.
StylepublicControls the appearance of items on the list box control and indicates whether the control uses "virtual mode".
TabOrderpublicIndicates the navigation order for the control when the user presses the Tab or Shift+Tab key.
TabStoppublicEnables keyboard navigation using the Tab or Shift+Tab keys.
TopIndexpublicIndex of the first visible (or top-most) item.
VisiblepublicAllows the control, and all of its children, to be displayed or hidden.

Methods

WSRegisterClassprotectedRegisters this component class with the current WidgetSet.
AssignItemDataToCacheprotectedCopies selected state for an item to the cache.
AssignCacheToItemDataprotectedSends the cached selection state to the widget.
BeforeDragStartprotectedNotifies the widgetset class that a Drag operation is starting.
BeginAutoDragprotectedStarts a non-immediate drag / dock operation for the control.
CalculateStandardItemHeightprotectedDetermines the standard Height of the items, when the widget has yet been created.
CreateParamsprotectedInitializes the creation parameters for the class instance.
InitializeWndprotectedUpdates Items from the widgetset class and invalidates the item cache.
DestroyWndprotectedFrees the handle for the window and its canvas.
FinalizeWndprotectedCaches the Items stored in the widgetset class.
GetControlClassDefaultSizeprotectedReturns the default dimensions for new instances of the class.
CheckIndexprotectedEnsures that the Item index is within the bounds for the Items in the control.
GetItemHeightprotectedGets the value for the ItemHeight property.
GetItemIndexprotectedGets the value for the ItemIndex property.
GetSelCountprotectedGets the value for the SelCount property.
GetSelectedprotectedGets the value for the Selected property.
GetCachedDataSizeprotectedReturns the size for cached item data in the control.
GetCachedDataprotectedReturns a pointer to the cached item data.
SetExtendedSelectprotectedSets the value for the ExtendedSelect property.
SetItemIndexprotectedSets the value for the ItemIndex property.
SetItemsprotectedSets the value for the Items property.
SetItemHeightprotectedSets the value for the ItemHeight property.
SetMultiSelectprotectedSets the value for the MultiSelect property.
SetSelectedprotectedSets the value for the Selected property.
SetSortedprotectedSets the value for the Sorted property.
SetStyleprotectedSets the value for the Style property.
DrawItemprotectedPaints an item in owner-draw mode.
DoAutoAdjustLayoutprotectedPerforms actions needed to auto-adjust the control using the specified layout policy.
DoSelectionChangeprotectedSignals the OnSelectionChange handler.
SendItemIndexprotectedSends the value in ItemIndex to the widgetset class instance.
WMGetDlgCodeprotectedHandles Tab, Return, Cursor keys, and Escape characters in control messages.
CreatepublicConstructor for the class instance.
DestroypublicDestructor for the class instance.
AddItempublicAdds an item to the list.
ClickpublicPerforms the Changed method when the control is clicked.
ClearpublicRemoves all items from the list box control.
ClearSelectionpublicUnselects all items in the control.
GetIndexAtXYpublicGets the index for the item at the given client coordinates.
GetIndexAtYpublicGets the index position for the item at the specified vertical coordinate.
GetSelectedTextpublicGet the text for all selected items as a string value.
ItemAtPospublicGet the item index for the given client coordinates.
ItemRectpublicReturns the client rectangle for an item (including scrollbar area).
ItemVisiblepublicReturns True if the item is at least partially visible in the scrollable list.
ItemFullyVisiblepublicReturns True if the item is fully visible in the scrollable list.
LockSelectionChangepublicBlocks selection changes during update to the widgetset class.
MakeCurrentVisiblepublicMakes the item at ItemIndex visible, possibly scrolling the list.
MeasureItempublicGets the height for an item in the list.
SelectAllpublicSelects all items in the list (in ExtendedSelect mode).
SelectRangepublicChanges the selection state for a range of Items in the control.
DeleteSelectedpublicRemoves one or more selected entries from the Items property.
UnlockSelectionChangepublicRemoves a previous selection change lock.

Events

OnDatapublicEvent handler signalled to provide the data for a "virtual" item on the list box control.
OnDataObjectpublicEvent handler signalled to get the TObject instance with the data for a "virtual" item on the list box control. Not used in the current LCL version.
OnDataFindpublicEvent handler signalled to get the ordinal position for a virtual list item with the specified string value. Not used in the current LCL version.
OnChangeBoundspublicEvent handler signalled when the Bounds for the control have been changed.
OnClickpublicNotification handler for mouse clicks.
OnDblClickpublicEvent handler signalled when a mouse double click occurs in the control.
OnDrawItempublicHandler for painting of a list item in owner-draw mode.
OnEnterpublicEvent handler signalled when the control receives focus.
OnExitpublicEvent handler signalled when the control loses focus.
OnKeyDownpublicEvent handler signalled for key down keyboard events.
OnKeyPresspublicEvent handler signalled for character data entered by the user.
OnKeyUppublicEvent handler signalled when a key up event has occurred for the control.
OnMeasureItempublicHandler invoked when the height for an item is needed.
OnMouseDownpublicEvent handler signalled when a mouse down event is handled for the control.
OnMouseEnterpublicEvent handler signalled when the mouse pointer has entered the control.
OnMouseLeavepublicEvent handler signalled when the mouse pointer has left the control.
OnMouseMovepublicEvent handler signalled when the mouse pointer is moved in the control.
OnMouseUppublicEvent handler signalled when a mouse up event is handled for the control.
OnMouseWheelpublicEvent handler for mouse wheel turned.
OnMouseWheelDownpublicEvent handler signalled for a downward movement of the mouse wheel.
OnMouseWheelUppublicEvent handler signalled for an upward movement of the mouse wheel.
OnResizepublicNotification handler for a resize of the control.
OnSelectionChangepublicHandler invoked when an item is selected in the control.
OnUTF8KeyPresspublicHandler for a character entered by the user.

Inherited

From TWinControl (230)

AddControl AdjustClientRect AlignControls AllAutoSized AutoAdjustLayout AutoSizeDelayed AutoSizeDelayedHandle AutoSizeDelayedReport AutoSizePhases BeginUpdateBounds BorderWidth BoundsLockCount BroadCast Brush BrushCreated CachedClientHeight CachedClientWidth CalculatePreferredSize CanFocus CanSetFocus CanTab ChangeScale ChildClassAllowed ChildHandlesCreated ChildKey ChildSizing ClientRectNeedsInterfaceUpdate CMBiDiModeChanged CMBorderChanged CMDoubleBufferedChanged CMEnabledChanged CMEnter CMExit CMParentDoubleBufferedChanged CMShowHintChanged CMShowingChanged CMVisibleChanged CNChar CNKeyDown CNKeyUp CNSysKeyDown CNSysKeyUp ContainsControl ControlAtPos ControlCount ControlKeyDown ControlKeyUp Controls ControlsAligned CreateBrush CreateDockManager CreateHandle CreateParented CreateParentedControl CreateSubClass CreateWnd CustomAlignInsertBefore CustomAlignPosition DefaultHandler DefWndProc DesignerDeleting DestroyHandle DialogChar DisableAlign DoAddDockClient DoAdjustClientRectChange DoAlignChildControls DoAllAutoSize DoAutoSize DoChildSizingChange DockClientCount DockClients DockDrop DockManager DockOver DockSite DoConstraintsChange DoDockClientMsg DoDockOver DoDragMsg DoEnter DoExit DoFlipChildren DoFloatMsg DoGetDockCaption DoKeyDownBeforeInterface DoKeyPress DoKeyUpBeforeInterface DoRemainingKeyDown DoRemainingKeyUp DoRemoveDockClient DoSendBoundsToInterface DoSendShowHideToInterface DoSetBounds DoubleBuffered DoUnDock DoUndockClientMsg DoUTF8KeyPress EnableAlign EndUpdateBounds EraseBackground FindChildControl FindNextControl FixDesignFontsPPIWithChildren FixupTabList FlipChildren Focused FontChanged FormEndUpdated GetAdjustedLogicalClientRect GetBorderStyle GetChildren GetChildrenRect GetClientOrigin GetClientRect GetControlIndex GetControlOrigin GetDeviceContext GetDockCaption GetEnumeratorControls GetEnumeratorControlsReverse GetMouseCapture GetParentHandle GetPreferredSizeClientFrame GetSiteInfo GetTabOrderList GetTextLen GetTopParentHandle Handle HandleAllocated HandleNeeded InsertControl IntfGetDropFilesTarget IntfUTF8KeyPress Invalidate InvalidateBoundsRealized InvalidateClientRectCache InvalidatePreferredChildSizes IsClientHeightStored IsClientWidthStored IsControlMouseMsg IsFlipped IsResizing IsSpecialSubControl KeyDown KeyDownAfterInterface KeyDownBeforeInterface KeyPress KeyUp KeyUpAfterInterface KeyUpBeforeInterface Loaded LockRealizeBounds MainWndProc NotifyControls OnAlignInsertBefore OnAlignPosition OnDockDrop OnDockOver OnGetDockCaption OnGetSiteInfo OnUnDock PaintControls PaintHandler PaintTo PaintWindow ParentDoubleBuffered ParentFormHandleInitialized ParentHandlesAllocated ParentWindow PerformTab RealGetText ReAlign RealizeBounds RealizeBoundsRecursive RealSetText ReloadDockedControl RemoveControl RemoveFocus Repaint ScaleBy ScaleControls ScrollBy ScrollBy_WS SelectFirst SelectNext SendDialogChar SendMoveSizeMessages SetBorderStyle SetBounds SetChildZPosition SetColor SetControlIndex SetDockManager SetFocus SetShape SetTempCursor ShowControl Showing UnlockRealizeBounds Update UpdateControlState UpdateDockCaption UpdateShowing UseDockManager UTF8KeyPress VisibleDockClientCount WindowHandle WMChar WMContextMenu WMDestroy WMEnter WMEraseBkgnd WMExit WMKeyDown WMKeyUp WMKillFocus WMMove WMNotify WMPaint WMSetFocus WMShowWindow WMSize WMSysChar WMSysKeyDown WMSysKeyUp WMWindowPosChanged WndProc WriteLayoutDebugReport WSSetText

From TControl (340)

AccessibleDescription AccessibleName AccessibleRole AccessibleValue Action ActionChange ActionLink ActiveDefaultControlChanged AddHandler AddHandlerOnBeforeDestruction AddHandlerOnChangeBounds AddHandlerOnEnabledChanged AddHandlerOnEnabledChanging AddHandlerOnKeyDown AddHandlerOnMouseWheel AddHandlerOnResize AddHandlerOnVisibleChanged AddHandlerOnVisibleChanging AdjustSize AnchorAsAlign AnchorClient AnchoredControlCount AnchoredControls AnchorHorizontalCenterTo AnchorParallel AnchorSame AnchorSide AnchorSideBottom AnchorSideChanged AnchorSideLeft AnchorSideRight AnchorSideTop AnchorToCompanion AnchorToNeighbour AnchorVerticalCenterTo AssignTo AutoSize AutoSizing AutoSizingAll AutoSizingLockCount BaseBounds BaseParentClientSize BeforeDestruction BeginAutoSizing BeginDrag BiDiMode BorderSpacing BoundsChanged BoundsRect BoundsRectForNewParent BringToFront CalculateDockSizes CanAutoSize Caption CaptureChanged CaptureMouseButtons ChangeBounds Changed CheckChildClassAllowed CheckNewParent CheckOnChangeBounds ClientHeight ClientOrigin ClientRect ClientToParent ClientToScreen ClientWidth CMChanged CMCursorChanged CMHintShow CMHitTest CMMouseEnter CMMouseLeave CMParentBiDiModeChanged CMParentColorChanged CMParentFontChanged CMParentShowHintChanged CMSysFontChanged CMTextChanged CNPreferredSizeChanged Color ColorIsStored ConstrainedResize ControlFontClass ControlOrigin ControlState ControlStyle ControlToScreen CreateAccessibleObject CreateControlBorderSpacing CreateFloatingDockSite Cursor DblClick DefineProperties DesktopFont DisableAutoSizing DoBorderSpacingChange DoCallKeyEventHandler DoCallMouseWheelEventHandler DoCallNotifyHandler Dock Docked DockOrientation DockTrackNoTarget DoContextPopup DoDock DoEndDock DoEndDrag DoFixDesignFontPPI DoMouseDown DoMouseUp DoMouseWheel DoMouseWheelDown DoMouseWheelHorz DoMouseWheelLeft DoMouseWheelRight DoMouseWheelUp DoOnChangeBounds DoOnParentHandleDestruction DoOnResize DoOnShowHint DoScaleFontPPI DoStartDock DoStartDrag DragCanceled DragCursor DragDrop Dragging DragKind DragMode DragOver EditingDone EnableAutoSizing Enabled EnabledChanged EnabledChanging EndAutoSizing EndDrag ExecuteCancelAction ExecuteDefaultAction FindSubComponent FixDesignFontsPPI Floating FloatingDockSiteClass ForeignAnchorSideChanged FormIsUpdating GetAccessibleObject GetAction GetActionLinkClass GetAnchorsDependingOnParent GetCachedText GetCanvasScaleFactor GetChildAccessibleObjectAtPos GetClientScrollOffset GetColorResolvingParent GetCursor GetDefaultColor GetDefaultDockCaption GetDefaultHeight GetDefaultWidth GetDockEdge GetDragImages GetEnabled GetFloating GetFloatingDockSiteClass GetLogicalClientRect GetMousePosFromMessage GetPalette GetParentBackground GetParentComponent GetPopupMenu GetPreferredSize GetRGBColorResolvingParent GetScrolledClientRect GetSelectedChildAccessibleObject GetSidePosition GetTextBuf GetTopParent HandleObjectShouldBeVisible HasHelp HasParent Height HeightIsAnchored HelpContext HelpKeyword HelpType Hide Hint HostDockSite InitiateAction InvalidateControl InvalidatePreferredSize IsAParentAligning IsBorderSpacingInnerBorderStored IsCaptionStored IsControl IsControlVisible IsEnabled IsParentColor IsParentFont IsParentOf IsProcessingPaintMsg IsRightToLeft IsVisible Left LMCaptureChanged LoadedAll LRDockWidth ManualDock ManualFloat MouseCapture MouseDown MouseEnter MouseInClient MouseLeave MouseMove MouseUp Notification OnConstrainedResize OnContextPopup OnDragDrop OnDragOver OnEditingDone OnEndDock OnEndDrag OnMouseWheelHorz OnMouseWheelLeft OnMouseWheelRight OnQuadClick OnShowHint OnStartDock OnStartDrag OnTripleClick Parent ParentBackground ParentBiDiMode ParentDestroyingHandle ParentFontChanged ParentToClient Perform PositionDockRect QuadClick ReadBounds ReadState Refresh RemoveAllHandlersOfObject RemoveHandler RemoveHandlerOnBeforeDestruction RemoveHandlerOnChangeBounds RemoveHandlerOnEnabledChanged RemoveHandlerOnEnabledChanging RemoveHandlerOnKeyDown RemoveHandlerOnMouseWheel RemoveHandlerOnResize RemoveHandlerOnVisibleChanged RemoveHandlerOnVisibleChanging ReplaceDockedControl RequestAlign Resize Scale96ToFont Scale96ToForm Scale96ToScreen ScaleConstraints ScaleDesignToForm ScaleFontsPPI ScaleFontTo96 ScaleFontToScreen ScaleFormTo96 ScaleFormToDesign ScaleScreenTo96 ScaleScreenToFont ScreenToClient ScreenToControl SendToBack SessionProperties SetAction SetAlign SetAnchors SetAutoSize SetBiDiMode SetBoundsKeepBase SetCursor SetDragMode SetEnabled SetHint SetInitialBounds SetName SetParent SetParentBackground SetParentBiDiMode SetParentComponent SetTextBuf SetVisible SetZOrder ShouldAutoAdjust Show ShowHelp TBDockHeight Text TextChanged Top TripleClick UndockHeight UndockWidth UpdateAnchorRules UpdateBaseBounds UpdateMouseCursor UpdateRolesForForm UseRightToLeftAlignment UseRightToLeftReading UseRightToLeftScrollBar VisibleChanged VisibleChanging Width WidthIsAnchored WindowProc WMCancelMode WMLButtonDBLCLK WMLButtonDown WMLButtonQuadCLK WMLButtonTripleCLK WMLButtonUp WMMButtonDBLCLK WMMButtonDown WMMButtonQuadCLK WMMButtonTripleCLK WMMButtonUp WMMouseHWheel WMMouseMove WMMouseWheel WMRButtonDBLCLK WMRButtonDown WMRButtonQuadCLK WMRButtonTripleCLK WMRButtonUp WMXButtonDBLCLK WMXButtonDown WMXButtonQuadCLK WMXButtonTripleCLK WMXButtonUp

From TLCLComponent (6)

DecLCLRefCount GetWSComponentClass IncLCLRefCount LCLRefCount NewInstance WidgetSetClass

From TComponent (64)

_AddRef _Release CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetDeltaStreams GetEnumerator GetIDsOfNames GetNamePath GetObservers GetOwner GetTypeInfo GetTypeInfoCount iicrGetComponent InsertComponent Invoke IsImplementorOf Loading Name ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetChildOrder SetDesigning SetDesignInstance SetInline SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState

From TPersistent (4)

Assign FPOAttachObserver FPODetachObserver FPONotifyObservers

From TObject (35)

AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.