Article ID: 130835 - View products that this article applies to.
This article was previously published under Q130835
This article has been archived. It is offered "as is" and will no longer be updated.
The Class Browser is a tool provided with the Professional Edition of Visual FoxPro. It allows you to browse and perform diverse tasks on classes stored in visual class libraries (.VCX files). In particular, you can use the Class Browser to save the source code for class definitions to a program file.
Saving the source code of a visual class definition to a program file might be useful when debugging an application. The EXPORTCLASS() method of the Class Browser generates and displays the definition source code of a selected class.
You can save this information to a program file (.PRG). The EXPORTCLASS method is called when you choose the View Class Code button in the Class Browser. You can also call it interactively, or customize the Class Browser to prompt a Save As dialog to save information to a file. These two methods are described below.
NOTE: Attempting to run the .prg file may create an error. Not all of the code exported to the .prg file is directly supported by the Visual FoxPro language. The ExportClass method is not intended to create program code for a class definition. Its purpose is to allow you to view how the class is defined. In particular, the type of objects that will not work when the code from the Class Browser is exported to a program file are container type objects that contain other objects. For example, if you create a grid and change the ColumnCount property to something other than -1, and use the Class Browser to export the code to a .prg file, you will receive an "Syntax Error" message when trying to run the .prg file. This happens because there is a set number of columns, headers, and text boxes assigned to the grid. If the ColumnCount is left at -1, the grid will properly populate itself from the table dynamically. The same thing happens with a PageFrame. If the code for the PageFrame is copied to a .prg file and there are no objects on the PageFrame, then the code works properly. Adding an object to the PageFrame and then copying the code to a .prg file causes the "Syntax Error" message.
Method One: Use the ExportClass Method Interactively
Method Two: Create an Add-in to Customize the View Class Definition ButtonWARNING: If you use the following information to customize the Class Browser, your customized Class Browser may no longer be supported by Microsoft.
You can create an add-in that will extend the functionality of the View Class Definition button. To execute this add-in, right-click the View Class definition button. The code is displayed in a window, and the SaveAs dialog is displayed to save the code to a program file. Sample code for the add-in is included below.
For more information about the ExportClass and the Addin methods of the Class Browser, please search for "Class Browser Methods" in the Help menu.
How to Install or Remove the Add-InTo install the add-in:
To remove the add-in, type the following code in the Command window:
Sample Code for the Add-In
Contact us for more help