ListView

Object List Hierarchy Next Object

Definition:

Displays items in one of four available views: Icon, Small Icon, List, or Report. You can organize items into columns, include or omit column headings, and display associated icons and text if desired.

Icon: images/Phx00187.gif

Specialized Features:

The following table lists and describes the properties, methods, and events that are added by ListView:


Property Use to…


Arrange Enter a value that specifies how the icons are organized in a ListView control's Icon or SmallIcon view only.

HideColumnHeaders Indicate whether the ColumnHeader objects in a ListView control are visible or hidden when using Report view only.

HideSelection Specify whether or not interactive editing of the item labels is allowed.

LabelEdit Specify whether or not interactive editing of the item labels is allowed.

LabelWrap Specify whether or not labels can wrap to the next line when a ListView control is in Icon view.

LargeIcons Reference the Imagelist object that provides the bitmap images for the LargeIcon index of each ListItem.

ListCount Indicate the number of items in the list.

NumColumns Indicate the number of ColumnHeader objects embedded in the ListView control. Each embedded ColumnHeader object produces a column of the list

SelCount The number of ListItems that are selected in the ListView.

SmallIcons Reference the ImageList object that provides the bitmap images for the SmallIcon index of each ListItem.

Sorted Provide a value that determines whether to sort the items in the list or not.

SortKey Provides a value that specifies how which column to use for sorting. 0 is the first column, each number after that refers to a SubItemIndes.

SortOrder Provides a value that determines the order in which items are sorted: ascending or descending.

SortType Provides a value that determines the sorting criteria to use: alphabetic, numeric, date, time, or custom.

View Determines how the ListItem objects in a ListView control look. There are four available settings.


Method Use to…


AddItem Add another item to the ListView control. This method takes the index to add at, the text of the item, and the large and small icon indices.

Clear Remove all items from the list.

FindItem Finds a particular ListItem in a ListView control, then returns a reference to that ListItem.

GetFirstVisible Retrieves a reference to the first visible ListItem object in the ListView control's display area.

RemoveItem Remove a particular index from the list.

Item Return a reference to the ListItem at the specified index in the list.


Event Use to…


BeginLabelEdit Prepare for editing the label of a list item. This event can choose to limit the amount of text allowed and whether or not to deny the edit.

Click Perform an action when the user presses and releases a mouse button while on an object, or when the value of a control is changed in code.

DblClick Perform an action when the user presses and releases a mouse button twice in rapid succession over an object.

EndLabelEdit After the new text is entered, the event gets a chance to validate the input, change it, or deny the change.

GotFocus Define what occurs when an object is given the focus.

ItemClick Define what occurs when a ListItem object in a ListView control is clicked.

KeyDown Define what occurs when the user presses a key while an object has the focus.

KeyUp Define what occurs when the user releases a key while an object has the focus.

KeyPress Define what occurs when the user presses and releases an ANSI key.

LostFocus Define what occurs when an object loses the focus.

SortItem Handle custom sorting behavior for when SortType is Custom.

Copied Features:

images/Phx00188.gif Properties images/Phx00189.gif Methods images/Phx00190.gif Events

Details:

Use the ListView control to determine the characteristics of the list entries, which are called ListItem objects, that can be displayed in one of four views. The available views are Icon view, Small Icon view, List view, and Report view, which can be set using the View property. You can also determine whether the list entry labels are allowed to wrap to the next line by setting the LabelWrap property. The appearance of specified list entries as well as how they are sorted can also be controlled through other ListView properties.

A ListItem object defines the various characteristics of items in the ListView control. These characteristics include:

images/Phx90000.gif A short item description.

images/Phx90000.gif Icons that can be displayed with the item. Icons are supplied by an ImageList control.

images/Phx90000.gif Subitems, which are additional pieces of text related to a ListItem object. You can display these subitems in Report view.

You can add ColumnHeaders at any time. You can also control the visibility of ColumnHeaders in the ListView control by setting the HideColumnHeaders property.