Microsoft KB Archive/163414

{| = PRB: Cannot Specify Icon or SmallIcon for ListView Visually =
 * width="100%"|

Last reviewed: June 17, 1997

Article ID: Q163414 5.00 WINDOWS kbinterop kbole kbprb The information in this article applies to:


 * Microsoft Visual FoxPro for Windows, version 5.0

SYMPTOMS
A form containing the ListView control suddenly loses the images shown in the listview. This happens after the form has been modified and any property of the ListView has been changed.

CAUSE
Right-clicking on the ListView control in the Form Designer will reveal a context menu. The bottom bar of that menu opens the ListViewCtrl Properties dialog box that holds a pageframe with four pages. Page 2 has the caption "Image Lists." It holds two combo box controls labeled "Normal" and "Small" (without the quotes.)

Comctl32.dll contains both the Imagelist control and the ListView control.

With the version of Comctl32.dll that originally came with Visual FoxPro 5.0, the Imagelists to be used for normal and small icons with the ListView control could be selected from those combo boxes on the "Image List" page of the ListViewCtrl Properties dialog box. You could drop either combo box down and see all of the Imagelist controls on the current form. Typically, there would be two, but the application design might require even more. A ListView for each size icon can be associated with only one Imagelist and different Imagelists must be used for each size.

Several Microsoft developer products released since Visual FoxPro version 5.0 install a revised Comctl32.dll.

In the Form Designer of Visual FoxPro 5.0, the new version of ListView no longer lists in the ListViewCtrl properties dialog "Image Lists" page, the ImageLists that reside on the current form. For each size icon, it shows the expression [none].

Clicking the "Apply" button at the bottom of the page sets all of the properties to the settings shown, so the new ImageList properties are "none."

RESOLUTION
The ImageLists must be specified in code. For example, if the form has an Imagelist for normal-sized icons in the OLE container control "OleControl1," and one for small icons in "OleControl2," then you need to add two commands similar to the following in the init event method for the OLE container control that holds the ListView:

This.object.icon = thisform.olecontrol1.object This.object.smallicon = thisform.olecontrol2.object The above is only a suggestion. The specifics of the application will determine where to make the modification and the appropriate syntax to use.

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Steps to Reproduce Problem
In Microsoft Visual FoxPro for Windows version 5.0:


 * 1) In the Form Designer, modify a form using the ListView control. The form should have been designed using the ListViewCtrl Properties dialog.
 * 2) Modify any property of the ListView in the ListViewCtrl Properties dialog box.
 * 3) Choose Apply and then choose OK.

The value "[none]" is now saved as the Imagelist "Icon" and "SmallIcon" properties. Consequently, no ImageList is specified for either the Icon or SmallIcon source of the ListView.
 * }