Chapter 17. ListControl Class

Table of Contents
View Styles
Methods of the ListControl Class
Notification Messages

A list view control is a window that displays a collection of items, with each item consisting of an icon and a label. It provides several ways of arranging and displaying items. Refer to OODLIST.REX in the OODIALOG\SAMPLES directory for an example.

Use the GetListControl method (see page GetListControl) to retrieve an object of the ListControl class.

Notes

The ListControl class is the ooDialog interface to the Windows List-View control. This should not be confused with the Windows List Box control. The ooDialog ListBox class provides the interface to the Windows List Box control. In general, the List-View control is more powerful than the List Box control.

List-View Extended Styles: The List-View control has been updated by Microsoft to include a number of extended styles. These styles are similar to the styles that can be used to create a ListControl, (see the AddListControl method,) like the NOHEADER or SINGLESEL styles. However, the way that they are added or removed from the ListControl is different. For instance, the extended styles can not be added to a ListControl at the time of creation. They can only be added after the underlying Windows control has been created. For all practical purposes this means in the InitDialog method, or at some point in the life cycle of the dialog after that.

Some of the extended styles are only available on later versions of the Windows OS. As an example, the LABELTIP and SIMPLESELECT styles are only available on Windows XP. The documentation on the extended styles will note any requirements for each style. To work with the extended List-View styles, use the AddExtendedStyle, the RemoveExtendedStyle, or the ReplaceExtendedStyle methods.

Note: There are a number of nuances to the behavior of the different extended styles on the different versions of Windows, far too many to try and detail in this documentation. The behavior documented here is the general behavior on Windows XP with service pack 2.

If there is a need for detailed information concerning the subtle differences in behavior on earlier versions of Windows, the programmer should consult the Windows documentation.

Requires:

The ListControl class requires the class definition file oodwin32.cls:

::requires "oodwin32.cls"

Methods:

Instances of the ListControl class implement the methods listed in the ListControl Instance Methods table.

Table 17-1. ListControl Instance Methods

Method......on page
AddAdd
AddRowAddRow
AddExtendedStyleAddExtendedStyle
AddStyleAddStyle
AlignLeftAlignLeft
AlignTopAlignTop
ArrangeArrange
BkColorBkColor
BkColor=BkColor=
CheckCheck
CheckAllCheckAll
ColumnInfoColumnInfo
ColumnWidthColumnWidth
DeleteDelete
DeleteAllDeleteAll
DeleteColumnDeleteColumn
DeselectDeselect
DropHighlightedDropHighlighted
EditEdit
EndEditEndEdit
EnsureVisibleEnsureVisible
FindFind
FindNearestXYFindNearestXY
FindPartialFindPartial
FirstVisibleFirstVisible
FocusFocus
FocusedFocused
GetCheckGetCheck
GetExtendedStyleGetExtendedStyle
GetExtendedStyleRawGetExtendedStyleRaw
GetHoverTimeGetHoverTime
InsertInsert
InsertColumnInsertColumn
IsCheckedIsChecked
ItemInfoItemInfo
ItemPosItemPos
ItemStateItemState
ItemTextItemText
ItemsItems
ItemsPerPageItemsPerPage
LastLast
LastSelectedLastSelected
ModifyModify
ModifyColumnModifyColumn
NextNext
NextLeftNextLeft
NextRightNextRight
NextSelectedNextSelected
Prepare4nItemsPrepare4nItems
PreviousPrevious
PreviousSelectedPreviousSelected
RedrawItemsRedrawItems
RemoveImagesRemoveImages
RemoveExtendedStyleRemoveExtendedStyle
RemoveStyleRemoveStyle
RemoveSmallImagesRemoveSmallImages
ReplaceExtendedStyleReplaceExtendedStyle
ReplaceStyleReplaceStyle
RestoreEditClassRestoreEditClass
ScrollScroll
SelectSelect
SelectedSelected
SelectedItemsSelectedItems
SetColumnWidthSetColumnWidth
SetHoverTimeSetHoverTime
SetImagesSetImages
SetItemPosSetItemPos
SetItemStateSetItemState
SetItemTextSetItemText
SetSmallImagesSetSmallImages
SmallSpacingSmallSpacing
SnapToGridSnapToGrid
SpacingSpacing
StringWidthStringWidth
SubclassEditSubclassEdit
TextBkColorTextBkColor
TextBkColor=TextBkColor=
TextColorTextColor
TextColor=TextColor=
UncheckUncheck
UncheckAllUncheckAll
UpdateUpdate
UpdateItemUpdateItem

View Styles

List view controls can display their contents in different views. The current view is specified by the window style of the control. Additional window styles define the alignment of the items and the functionality of the list view control. The different views are:

Icon view

Each item appears as a full-sized icon with a label below it. The user can drag the items to any location in the list view.

Small-icon view

Each item appears as a small icon with a label to the left of it. The user can drag the items to any location.

List view

Each item appears as a small icon with a label to the left of it. The user cannot drag the items.

Report view

Each item appears on a separate line with information arranged in columns. The leftmost column contains the small icon and the label. All following columns contain subitems as specified by the application.