Microsoft KB Archive/171746
Article ID: 171746
Article Last Modified on 12/11/1999
- Microsoft Visual FoxPro 5.0 Standard Edition
- Microsoft Visual FoxPro 5.0a
This article was previously published under Q171746
When running Visual FoxPro under Windows 95, a class based on either a list box or a combo box that sets the Picture property in the class, does not display the picture either in the Form Designer when you add the class to a form, or when you run the form. If FoxPro is running under Windows NT 4.0, the picture does not appear in the Class Designer either.
This article includes two workarounds. The first adds a new property to the class that sets the Picture property to the new property. The second sets the Picture property in the form after the class is added. Both methods assume that the class has been created following steps 1-3 in the Steps to Reproduce Behavior section below.
Open the class in the Visual Class Designer. Either by selecting Open from the File menu and then clicking Visual Class Library as the file type or enter the following command in the Command window:
MODIFY CLASS list OF test.vcx
- Create a new property for the class by selecting New Property from the Class menu. Enter the property name; cPicture, for example. Click Close.
- Locate the Picture property on the Property Sheet. Copy the path to the graphic and file name from the Picture property and paste it to the new cPicture property.
In the Init of the class, add the following code:
This.Picture = This.cPicture
- Close and save the class.
- Run the form. The picture should appear next to each row in the list.
NOTE: If any code or comments are added to the Init of the List1 class on the form, add the DODEFAULT() statement to the Init of List1 to ensure that the parent class Init code is also executed.
- Create a form. Using the Form Controls Toolbar, click the View Classes button and select Add. Add the test class library. Click the list class and drop it onto the form.
In the Init of the form, enter code similar to the following:
Thisform.List1.Picture = ; "c:\vfp5\samples\graphics\bmps\assorted\bell.bmp"
- Save and run the form.
This method is similar to explicitly setting the Picture property of List1 of the Property sheet to the graphic.
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
Steps to Reproduce Behavior
Create a new class by either selecting New from File menu then selecting Class or enter the following code in the Command window:
CREATE CLASS list AS listbox OF test.vcx
Set the Picture property of the ListBox to a graphic:
NOTE: In Windows 95, the picture is visible in the Visual Class Designer.
- Save and close the class.
- Create a form. Using the Form Controls toolbar, click the View Classes button and select Add. Add test.vcx. Click the list class and drop it onto the form.
NOTE: The picture is not visible in the list class on the form.
- Right-click on the form to display the short-cut menu, and select Data Environment.
- Add the customer table from the \VFP5\Samples\Data directory, then click Close.
- Change the RowSource property of List1 to customer.contact and the RowSourceType property to 6 - Fields.
- Save and run the form.
Visual FoxPro Online Help file.
Keywords: kbprb KB171746