Compartir a través de


How to: Edit Event and Method Code

Events are user actions, such as clicks and mouse movements, or system actions, such as the progression of the system clock. Methods are procedures that are associated with the object and that are specifically invoked programmatically. For a discussion of events and methods, see Object-Oriented Programming. You can specify the code to be processed when an event is triggered or a method is invoked.

To edit event or method code

  1. From the View menu, choose Code.

  2. Select the event or method in the Procedure box.

  3. In the Edit window, write the code you want to be processed when the event is triggered or the method is invoked.

    For example, you could have a command button on a form with the caption "Quit." In the Click event for the button, include the line:

    THISFORM.Release
    

    Tip

    To move between procedures in the Code Editing window, press PAGE DOWN or PAGE UP.

When the user clicks the command button, the form is removed from the screen and from memory. If you don't want to release the form from memory, you could instead include the following line in the click event:

THISFORM.Hide

Note

If code associated with the Init event of a form set, a form, or any object on any form in a form set returns false (.F.), the form will not be created.

See Also

Tasks

How to: Add Properties and Methods to a Form

How to: Save Forms

How to: Run a Form

How to: Set Properties at Run Time

Concepts

Controlling Form Behavior

Other Resources

Creating Forms