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

# TListView

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

TListView - a window showing a list of Items which may or may not have associated icons.

## Declaration

Source position: comctrls.pp line 1695

`type TListView = class(TCustomListView)`
`published`
`property Align: TAlign;` |  | Specifies the placement of the control on its Parent control.
`property AllocBy: Integer;` |  | Reduces allocation overhead in the widgetset class by increasing the internal buffer capacity by this block size.
`property Anchors: TAnchors;` |  | The set of anchor definitions for this control.
`property AutoSort: Boolean;` |  | Controls automatic updates to the sort column and order indicator for the control.
`property AutoSortIndicator: Boolean;` |  | Indicates if the control automatically changes the column and/or order indicator when a column is clicked.
`property AutoWidthLastColumn: Boolean; [rw]` |  | Resizes the last visible column to fill the remaining display area for the control.
`property BorderSpacing: TControlBorderSpacing;` |  | Determines the inner and outer border spacing for this control.
`property BorderStyle: TBorderStyle;` |  | Line style drawn as a border around the control.
`property BorderWidth: TBorderWidth;` |  | Width of the Border around the control; default is zero.
`property Checkboxes: Boolean;` |  | Displays a check box column for the list items on the control.
`property Color: TColor;` |  | The background color for the control.
`property Columns: TListColumns;` |  | Collection with the column definitions for the list view control (size, alignment, image index, etc.).
`property ColumnClick: Boolean;` |  | Enables or disables OnColumnClick events for column headers on the control.
`property Constraints: TSizeConstraints;` |  | Contains the minimum and maximum Width and Height for the control.
`property DragCursor: TCursor;` |  | The cursor shape shown during a drag operation.
`property DragKind: TDragKind;` |  | Indicates the action performed for a drag operation: drag-and-drop or drag-and-dock.
`property DragMode: TDragMode;` |  | Determines how a drag operation is started for the control.
`property Enabled: Boolean;` |  | Determines whether the control responds to mouse or keyboard input.
`property Font: TFont;` |  | The font to be used for text display in this control.
`property GridLines: Boolean;` |  | Enables or disables grid lines between rows and columns on the control.
`property HideSelection: Boolean;` |  | If control looses focus, don't paint selection background for selected item(s).
`property IconOptions: TIconOptions;` |  | Options for layouts, which show icons. Sets arrangement of icons, text-wrapping state.
`property Items: TListItems;` |  | Collection of list items displayed on the list view control.
`property LargeImages: TCustomImageList;` |  | Image list which contains "big" icons displayed for view styles on the control.
`property LargeImagesWidth: Integer;` |  | Contains the Width for the large images used in the list view.
`property MultiSelect: Boolean;` |  | Allows simultaneous selection of one or more list items using Ctrl+Click, Shift+Click, Ctrl+Shift+Click, or using program code.
`property OwnerData: Boolean;` |  | Enables or disables owner data (virtual) mode for the list view control.
`property OwnerDraw: Boolean;` |  | Indicates if owner-draw mode is used for the control.
`property ParentColor: Boolean;` |  | Uses the Color from the Parent control, when enabled.
`property ParentFont: Boolean;` |  | Indicates if the Font from the Parent control is used in the control.
`property ParentShowHint: Boolean;` |  | If True, the value of ShowHint for the control will be the same as the one from the Parent. Default is True.
`property PopupMenu: TPopupMenu;` |  | A context-sensitive menu that pops up when the right mouse button is clicked over this control.
`property ReadOnly: Boolean;` |  | Disables editing of list items on the control when set to True.
`property RowSelect: Boolean;` |  | Indicates if the entire row is highlighted when selected on the list view control.
`property ScrollBars: TScrollStyle;` |  | Specifies the scroll bars visible for the control.
`property ShowColumnHeaders: Boolean;` |  | Show header area in ListView, which shows captions of columns.
`property ShowHint: Boolean;` |  | Enables Hint display for the control.
`property SmallImages: TCustomImageList;` |  | Image list which contains "small" icons used for view styles.
`property SmallImagesWidth: Integer;` |  | Width for the images in the SmallImages property.
`property SortColumn: Integer;` |  | Ordinal position for the column used to sort the list items, or -1 when not assigned.
`property SortDirection: TSortDirection;` |  | Sorting direction (order) for the current SortColumn.
`property SortType: TSortType;` |  | Specifies the sorting mechanism used for the current SortColumn.
`property StateImages: TCustomImageList;` |  | Image list with the state images for the items on the control.
`property StateImagesWidth: Integer;` |  | Width of the images in the StateImages property.
`property TabStop: Boolean;` |  | Allows the user to navigate to / from the control by pressing the Tab or Shift+Tab keys.
`property TabOrder: TTabOrder;` |  | Indicates the navigation order for the control when the user presses the Tab or Shift+Tab key.
`property ToolTips: Boolean;` |  | Indicates if a hint (tool tip) is automatically displayed for the list item under the mouse cursor.
`property Visible: Boolean;` |  | Allows the control, and all of its children, to be displayed or hidden.
`property ViewStyle: TViewStyle;` |  | Sets one of ListView layouts: List (simple column), Report (few columns with full width), Icon (big icons), Small Icon (small icons, 16x16).
`property OnAdvancedCustomDraw: TLVAdvancedCustomDrawEvent;` |  | Event handler signalled to custom draw the grid control when the draw state is not cdPrePaint.
`property OnAdvancedCustomDrawItem: TLVAdvancedCustomDrawItemEvent;` |  | Event handler signalled to custom draw a list item on the grid control when the draw state is not cdPrePaint.
`property OnAdvancedCustomDrawSubItem: TLVAdvancedCustomDrawSubItemEvent;` |  | Event handler signalled to custom draw list sub-items when the draw stage is not cdPrePaint.
`property OnChange: TLVChangeEvent;` |  | Event handler signalled when the content for a list item is changed.
`property OnChanging: TLVChangingEvent;` |  | Event handler signalled when a change notification is received for a list item.
`property OnClick: TNotifyEvent;` |  | Notification handler for mouse clicks.
`property OnColumnClick: TLVColumnClickEvent;` |  | Event handler signalled when a column header for the control is clicked.
`property OnCompare: TLVCompareEvent;` |  | Event handler signalled to compare list items in the CustomSort method.
`property OnContextPopup: TContextPopupEvent;` |  | Invoked when a context-sensitive pop-up menu is requested.
`property OnCreateItemClass: TLVCreateItemClassEvent;` |  | Event handler signalled to get the class reference used to create new list view items.
`property OnCustomDraw: TLVCustomDrawEvent;` |  | Event handler signalled to perform custom drawing for the list view control.
`property OnCustomDrawItem: TLVCustomDrawItemEvent;` |  | Event handler signalled to perform custom drawing for list items on the control.
`property OnCustomDrawSubItem: TLVCustomDrawSubItemEvent;` |  | Event handler signalled to perform custom drawing for list sub-item on the control.
`property OnData: TLVDataEvent;` |  | Event handler signalled to the value(s) for a list item when OwnerData (virtual mode) has been enabled.
`property OnDataFind: TLVDataFindEvent;` |  | Event handler signalled to locate list item data when OwnerData (virtual) mode is enabled.
`property OnDataHint: TLVDataHintEvent;` |  | Event handler signalled to load a range of cached list items in the virtual storage for the control.
`property OnDataStateChange: TLVDataStateChangeEvent;` |  | Not used in the current LCL version.
`property OnDblClick: TNotifyEvent;` |  | Event handler signalled when a mouse double click occurs in the control.
`property OnDeletion: TLVDeletedEvent;` |  | Event handler signalled when a list item is deleted from the Items container.
`property OnDragDrop: TDragDropEvent;` |  | Event handler signalled when an object is dropped onto the control.
`property OnDragOver: TDragOverEvent;` |  | Event handler signalled when a control is dragged over the control instance.
`property OnDrawItem: TLVDrawItemEvent;` |  | Event handler signalled to render an owner drawn item.
`property OnEdited: TLVEditedEvent;` |  | Event handler signalled prior to updating a list item caption when it has been edited in the control.
`property OnEditing: TLVEditingEvent;` |  | Event handler signalled to determine if editing can be performed for a list item in the control.
`property OnEndDock: TEndDragEvent;` |  | Event handler signalled for the end of a drag-dock operation.
`property OnEndDrag: TEndDragEvent;` |  | Event handler signalled for the end of a drag-drop operation.
`property OnEnter: TNotifyEvent;` |  | Event handler signalled when the control receives focus.
`property OnExit: TNotifyEvent;` |  | Event handler signalled when the control loses focus.
`property OnInsert: TLVInsertEvent;` |  | Event handler signalled when a list item is added to or inserted in the Items for the control.
`property OnItemChecked: TLVCheckedItemEvent;` |  | Event handler signalled when the Checked property for a list item has been changed.
`property OnKeyDown: TKeyEvent;` |  | Event handler signalled for key down keyboard events.
`property OnKeyPress: TKeyPressEvent;` |  | Event handler signalled for character data entered by the user.
`property OnKeyUp: TKeyEvent;` |  | Event handler signalled when a key up event has occurred for the control.
`property OnMouseDown: TMouseEvent;` |  | Event handler signalled when a mouse down event is handled for the control.
`property OnMouseEnter: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has entered the control.
`property OnMouseLeave: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has left the control.
`property OnMouseMove: TMouseMoveEvent;` |  | Event handler signalled when the mouse pointer is moved in the control.
`property OnMouseUp: TMouseEvent;` |  | Event handler signalled when a mouse up event is handled for the control.
`property OnMouseWheel: TMouseWheelEvent;` |  | Event handler for mouse wheel turned.
`property OnMouseWheelDown: TMouseWheelUpDownEvent;` |  | Event handler signalled for a downward movement of the mouse wheel.
`property OnMouseWheelUp: TMouseWheelUpDownEvent;` |  | Event handler signalled for an upward movement of the mouse wheel.
`property OnMouseWheelHorz: TMouseWheelEvent;` |  | Event handler signalled for a horizontal movement of the mouse wheel.
`property OnMouseWheelLeft: TMouseWheelUpDownEvent;` |  | Event handler signalled for a leftward movement of the mouse wheel.
`property OnMouseWheelRight: TMouseWheelUpDownEvent;` |  | Event handler signalled for a rightward movement of the mouse wheel.
`property OnResize: TNotifyEvent;` |  | Notification handler for a resize of the control.
`property OnSelectItem: TLVSelectItemEvent;` |  | Event handler signalled when the selected list item for the control is changed.
`property OnShowHint: TControlShowHintEvent;` |  | Event handler signalled when a hint window is displayed for the control.
`property OnStartDock: TStartDockEvent;` |  | Event handler for the start of a docking operation.
`property OnStartDrag: TStartDragEvent;` |  | Event handler signalled for the start of a dragging operation.
`property OnUTF8KeyPress: TUTF8KeyPressEvent;` |  | Handler for a character entered by the user.
`end;`

## Inheritance

`TListView` |  | TListView - a window showing a list of Items which may or may not have associated icons.
`TCustomListView` |  | TCustomListView is the base class for TListView.
`TWinControl` |  | Implements a windowed control which can contain other child controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TListView- a window showing a list of items which may or may not have associated icons.

At first this control looks very like TListBox but it has a much higher degree of complexity. It is capable of displaying Items in Columns of Rows and it can have images associated with the list Items.

The important information is held in Items, a string-list that can be created using the string-list editor obtained by right-clicking on the ListView in the Form Editor or by clicking on the ellipsis (...) next to the Items entry in the Object Inspector.

A typical application might have two image lists: LargeImages and SmallImages. They contain large and small sizes for the same collection of images. The index positions in the first list would correspond with those in the second list.

SmallImages (if assigned to a string-list) can be displayed beside the text strings in the list view and the programmer would supply code to ensure that when an item with its associated Small Image was selected, the corresponding Large Image would be displayed in another window.

One or more TImageList controls need to be added to the Form Designer and the ImageList Editor can be opened from the pop-up menu obtained by right-clicking on TImageList icon in the Form Designer. The image list can be populated by reading from files. Then in the StringList editor for Items the correct ImageIndex must be assigned to each entry in the list.

## See also

TCustomListView |  | TCustomListView is the base class for TListView.
TCustomImageList |  | The base class for TImageList.