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.
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.
The ListControl class requires the class definition file oodwin32.cls:
::requires "oodwin32.cls"
Instances of the ListControl class implement the methods listed in the ListControl Instance Methods table.
Table 17-1. ListControl Instance Methods
Method... | ...on page |
---|---|
Add | Add |
AddRow | AddRow |
AddExtendedStyle | AddExtendedStyle |
AddStyle | AddStyle |
AlignLeft | AlignLeft |
AlignTop | AlignTop |
Arrange | Arrange |
BkColor | BkColor |
BkColor= | BkColor= |
Check | Check |
CheckAll | CheckAll |
ColumnInfo | ColumnInfo |
ColumnWidth | ColumnWidth |
Delete | Delete |
DeleteAll | DeleteAll |
DeleteColumn | DeleteColumn |
Deselect | Deselect |
DropHighlighted | DropHighlighted |
Edit | Edit |
EndEdit | EndEdit |
EnsureVisible | EnsureVisible |
Find | Find |
FindNearestXY | FindNearestXY |
FindPartial | FindPartial |
FirstVisible | FirstVisible |
Focus | Focus |
Focused | Focused |
GetCheck | GetCheck |
GetExtendedStyle | GetExtendedStyle |
GetExtendedStyleRaw | GetExtendedStyleRaw |
GetHoverTime | GetHoverTime |
Insert | Insert |
InsertColumn | InsertColumn |
IsChecked | IsChecked |
ItemInfo | ItemInfo |
ItemPos | ItemPos |
ItemState | ItemState |
ItemText | ItemText |
Items | Items |
ItemsPerPage | ItemsPerPage |
Last | Last |
LastSelected | LastSelected |
Modify | Modify |
ModifyColumn | ModifyColumn |
Next | Next |
NextLeft | NextLeft |
NextRight | NextRight |
NextSelected | NextSelected |
Prepare4nItems | Prepare4nItems |
Previous | Previous |
PreviousSelected | PreviousSelected |
RedrawItems | RedrawItems |
RemoveImages | RemoveImages |
RemoveExtendedStyle | RemoveExtendedStyle |
RemoveStyle | RemoveStyle |
RemoveSmallImages | RemoveSmallImages |
ReplaceExtendedStyle | ReplaceExtendedStyle |
ReplaceStyle | ReplaceStyle |
RestoreEditClass | RestoreEditClass |
Scroll | Scroll |
Select | Select |
Selected | Selected |
SelectedItems | SelectedItems |
SetColumnWidth | SetColumnWidth |
SetHoverTime | SetHoverTime |
SetImages | SetImages |
SetItemPos | SetItemPos |
SetItemState | SetItemState |
SetItemText | SetItemText |
SetSmallImages | SetSmallImages |
SmallSpacing | SmallSpacing |
SnapToGrid | SnapToGrid |
Spacing | Spacing |
StringWidth | StringWidth |
SubclassEdit | SubclassEdit |
TextBkColor | TextBkColor |
TextBkColor= | TextBkColor= |
TextColor | TextColor |
TextColor= | TextColor= |
Uncheck | Uncheck |
UncheckAll | UncheckAll |
Update | Update |
UpdateItem | UpdateItem |
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:
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.
Each item appears as a small icon with a label to the left of it. The user can drag the items to any location.
Each item appears as a small icon with a label to the left of it. The user cannot drag the items.
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.