Partilhar via


Event Response

The code you include in an event procedure is executed when the event takes place. For example, the code you include in the Click event procedure of a command button is executed when the user clicks the command button.

You can programmatically cause Click, DblClick, MouseMove, and DragDrop events with the MOUSE command, or use the ERROR command to generate Error events and the KEYBOARD command to generate KeyPress events. You cannot programmatically cause any other events to occur, but you can call the procedure associated with the event. For example, the following statement causes the code in the Activate event of frmPhoneLog to be executed, but it doesn't activate the form:

frmPhoneLog.Activate

If you do want to activate the form, use the Show method of the form. Calling the Show method causes the form to be displayed and activated, at which point the code in the Activate event is also executed:

frmPhoneLog.Show

See Also

Object-Oriented Programming | Classes and Objects: The Building Blocks of Applications | Classes in Visual FoxPro | Preparation for Class Creation | Creating Classes | Modifying a Class Definition | Subclassing a Class Definition | Operating the Class Designer | Class Member Protection and Hiding | Specifying Design-Time Appearance | Creating, Copying, and Removing Class Library Files | Adding Classes to Forms | Default Property Setting Override | Container Hierarchy Object Referencing | Setting Properties | Calling Methods