Condividi tramite


Viewing Class Definition Code

If you want to see specific parameters or understand the logic behind a class, you can use the Class Browser to view the code for the class in one of three ways. You can even view the parent class code for a user-defined method.

To view class definition code

  1. In the Class Browser, select the class you want to view.
  2. Choose the View Class Code button.
  3. Visual FoxPro displays the definition code for the class you selected in a read-only window. You can use some of the editing commands from the Edit menu, such as Find, Copy, and Select All.

The class definition displayed in the read-only window includes all property settings and method and event code.

**Note   **The code displayed is for information. In many cases, you can save it to a program and run it directly, but code with nested containers will generate errors. To view type library information, use Object Browser.

To modify a class that is displayed in the Class Browser

  • Double-click the class in the Class list or press the spacebar on a selected class.

To edit method code of a method in the Members list

  • Double-click the method in the Members list.

When you modify a class or form while the Class Browser window is open, you can easily view the ParentClass code for a method or event.

To view ParentClass code for a method

  1. Double-click a class or member.

  2. If no code window is open in the Form Designer or Class Designer, choose Code from the View menu.

  3. Choose the Edit ParentClassMethod toolbar button.

    **Note   **You can also view code or modify a class by selecting the class in the Members list and pressing the SPACEBAR.

To save class definition code to a file

  1. Choose Export from the shortcut menu

    -or-

  2. Right-click the View Code button

  3. Specify the file name in the Open dialog box.

See Also

Adding Controls to Forms with the Class Browser | Browsing Classes with the Class Browser | Class Browser Buttons | Class Browser Window | Customizing the Class Browser | Filtering the Class Browser Class List | Managing Classes with the Class Browser | Modifying Class Icons and Descriptions | Running the Class Browser | Trace Window | Viewing Class Hierarchies | Viewing Type Library Information | Object Browser