JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

List Views

If tree views are all about displaying node hierarchies, like the folder hierarchy on a disk, then list views are all about displaying lists of items. You can see a list view in the right pane in the Windows Explorer (the part that displays what files are in a folder). You also can see a list view at work in Figure 10.3, which is the ListViews example on the CD-ROM.

Click To expand
Figure 10.3: A list view at work.

List views can display their items in four view modes: View.LargeIcon, View.SmallIcon, View.List, and View.Details; you set the view by assigning one of those values to the list view's View property. You can select all of these views in the ListViews example on the CD-ROM to compare them (use the combo box at lower right). The large icon mode displays large icons (large icons are 32×32 pixels) next to the item text. The small icon mode is the same except that it displays items using small icons (small icons are 16×16 pixels). The list mode displays small icons, always in one column. The report mode (also called the details mode) displays items in multiple columns, displaying column headers as you see in Figure 10.3. All of the view modes can display images from image lists.

The central property of list views is ListItems, which contains the items displayed by the control. The SelectedItems property contains a collection of the items currently selected in the control. Note that the user can select multiple items if the MultiSelect property is set to True, and like tree views, list views can display checkboxes next to the items, if the CheckBoxes property is set to True.

You can use the SelectedIndexChanged event to handle item selections, and ItemCheck events to handle checkmark events. The Activation property sets what action the user must take to activate an item in the list: the options are Standard, OneClick, and TwoClick. OneClick requires a single click to activate the item. TwoClick requires the user to double-click (a single click changes the color of the item text). Standard requires the user to double-click to activate an item (but in this case, the item does not change appearance). You can sort the items in a list view with the Sorting property.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor