PRB: ListBox/ComboBox Picture Won't Display If Defined in Class (171746)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
This article was previously published under Q171746 SYMPTOMS
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.
RESOLUTION
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.
Method 1- 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.
Method 2- 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.
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
REFERENCES
Visual FoxPro Online Help file.
Modification Type: | Major | Last Reviewed: | 12/11/1999 |
---|
Keywords: | kbprb KB171746 kbAudDeveloper |
---|
|