JavaScript Editor js editor     Web development 

Main Page

File: ...\Samples\Solution\Toledo\FrmEvents.scx

This sample demonstrates binding events, raising events programmatically, unbinding events, and retrieving events for _SCREEN system variable, or the main Visual FoxPro window. In the sample, you can manually raise a bound event for _SCREEN by selecting an event from the combo box or invoke the same events and their respective handlers by using the mouse.

For more information about _SCREEN, see _SCREEN System Variable.

Binding Events

To respond to Visual FoxPro events, use the BINDEVENT( ) function. In this sample, the BINDEVENT( ) function is called in the custom InitBindEvent method and binds several _SCREEN events to the form's methods. When one of the _SCREEN events fires, the associated handler method is called:

В Copy Code

For more information, see BINDEVENT() Function and Init Event.

Raising Events Programmatically

To raise events programmatically, use the RAISEEVENT( ) function. In this sample, when the combo box is selected, the InteractiveChange event uses the returned value to programmatically raise the specified event.

В Copy Code

For more information, see RAISEEVENT() Function and InteractiveChange Event.

Unbinding Events

To unbind event handlers, use the UNBINDEVENTS( ) function. In this sample, the custom UnbindHandlers method unbinds events for _SCREEN.

В Copy Code

For more information, see UNBINDEVENTS() Function.

Retrieve Event Bindings

To retrieve existing event bindings into an array, use the AEVENTS( ) function. In this sample, the custom ScreenDblClick method, which is bound to the _SCREENВ DblClick event, uses the AEVENTS( ) function to report the number of event bindings:

В Copy Code

For more information, see AEVENTS() Function, and DblClick Event.

See Also

JavaScript Editor js editor     Web development