Viewing Class Definition Code

See Also

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 modify a class that is displayed in the Class Browser

To edit method code of a 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 ParentClass Method 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. -Or-
    1. Right-click the View Code button

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