Class that provides access to the enhanced features of the MS ListView common control.
This class acts as a wrapper for the common dialog ListView control. It provides several useful enhancements such as full-row select and sorting when the user clicks the column header when the listview control is in report view.
It allows you to specify additional styles such as check boxes, and gridlines, as well as functions to set and get the value of the check boxes.
Note that you must insert a ListView control onto a form in order to create a reference to the common controls library before the class will compile.
|
Procedure Name
|
Type
|
Description
|
|
(Declarations)
|
Declarations
|
Declarations and private variables for the CListViewEnh class
|
|
CheckBoxStyle
|
Property
|
Gets the ListView control's CheckBox style
|
|
Checked
|
Property
|
Gets the value of the Checked property for the specified ListView item.
The line items for the listview control are numbered starting at zero.
Set the indexed property to true or false to change the state of the check box on the selected row.
Test the value of the indexed property to find out whether or not the row is currently checked.
|
|
FullRowSelect
|
Property
|
Sets the FullRowSelect style for the ListView control
By default when you click on an item in a listview control when in report view, only the data in the first column is visibly selected.
You can set a style attribute for the listview control so that the entire row is selected.
Set this property to true to enable the full row select style, or false to disable full row select.
|
|
GridLines
|
Property
|
Sets whether light gray GridLines are shown vertically and horizontally between the "cells" of the columns and rows of the list view
|
|
ListView
|
Property
|
Gets a pointer to the private ListView control. You must set this property before using any of the other methods and properties of this class.
|
|
Redraw
|
Property
|
Sets the value of the control's Redraw property.
To speed up loading items into the listview control you can set the Redraw property to false. When all items are added, set Redraw back to true. This can reduce the flashing effect as items are added.
|
|
AutoSizeColumns
|
Method
|
Sizes each column in the ListView control to fit the widest data in each column
|
|
Class_Terminate
|
Terminate
|
Release resources used for this class
|
|
GetCheckState
|
Private
|
Return value of check box when List View is in Report view and the list view has the Check Box style attribute.
This function is a private helper function used with the Checked property of the class.
See "CheckBoxStyle" property
|
|
HandleClick
|
Method
|
Call this sub from the Onclick event of the assigned ListView control. For systems that do not have the updated
version of the common controls which allow full-row selecting, this procedure causes the list item to be
selected even if the user clicks on a column other than the first one. It tests the location of the click on the
entire ListView control, determines which row was "clicked" and then selects that item.
|
|
HandleColumnClick
|
Method
|
Call this sub from the OnColumnClick event of the assigned ListView control.
This causes the data in the ListView to be sorted in the order of the items in the column whose header was clicked.
|
|
HideColumn
|
Method
|
Hide the specified column by making its width 0
|
|
SetCheckBoxStyle
|
Private
|
Sets the list view control style to include or remove the check box style.
This function is a private helper function used with the CheckBoxStyle property of the class.
|
|
SetCheckState
|
Private
|
Set the check box on or off for the selected row in a List View control. Control must be set to Report
view and have the Check Box style attribute.
This function is a private helper function used with the Checked property of the class.
|
|
SetFullRowSelect
|
Private
|
Sets the list view control so that when a list item is selected in report view, the entire row is selected.
This function is a private helper function used with the FullRowSelect property of the class.
|
|
SetGridLines
|
Private
|
Sets the list view control style to include or remove the grid line style.
This function is a private helper function used with the GridLines property of the class.
|
|
SetRedraw
|
Private
|
Suppress or allow redrawing of the ListView control. During long operations, such as sorting, resizing,
or while loading the ListView control, turning off redrawing can improve appearance and performance.
This function is a private helper function used with the Redraw property of the class.
|