How to: Display Inherited Code for Objects, Events, and Methods

You can view code inherited from parent classes if it exists for objects, events, and methods, making it easier to decide whether you want to use or override the inherited code.

Note

The View Parent and View Inherited Code features support only the viewing of parent code, not editing. To edit parent class code for a subclass, use the Class Browser. For more information, see How to: View Class Definition Code and Operating the Class Browser.

To view inherited code using the code window

  1. Perform one of the following:

    • On the form, double-click the object you want.

    - OR -

    • In the properties list of the Properties window, double-click an event or method.

    A code window opens for the object, event, or method.

  2. In the code window, click View Parent Code to display the list of all parent classes.

    Note

    View Parent Code is available in the code window only when there is at least one parent class that contains code. When source code exists, parent classes appear in bold.

    Tip

    You can also click View Parent Code in the code window by pressing ALT+I.

  3. Select the parent class.

    An editing window opens and displays the parent code.

If inherited code exists for a method or event, the parent class name and class libraries from which the method or event inherits code appear in the properties list of the Properties window as follows:

        Inherited cClassname ClassLibrary

Visual FoxPro displays only those parent classes for the selected control. If a list of parent classes is available, the parent classes appear in order from the most immediate or top parent class to the one closest to the base class, traversing the parent tree. The base class does not appear.

If code inherited from the immediate parent class exists, and the parent class is a member of a container class, Visual FoxPro displays the container class followed by a separator and then the classes in the parent tree. Other classes that traverse the container hierarchy might contain code but are not displayed in the list.

Viewing inherited code using the properties list in the Properties window traverses the parent or container tree to reach the inherited parent class.

See Also

Tasks

How to: Add Properties and Methods to a Form

How to: Edit Event and Method Code

Concepts

Controlling Form Behavior

Reference

Form Designer

Other Resources

Manipulating Objects

Creating Forms