Event Statement

Defines the signature for an event handler.


Event event_name [ parameter_list ]


Necessary name for the event
Zero or more variable declarations between optional parentheses with a comma between each declaration. See Parameter List for more information.


The name is a type that can be used in a parameter passed to a constructor or method. Such procedures must be passed the name of a Sub that has a signature that matches that specified by parameter_list.


Listing 1: In a system library
Event EWindowClose(#win As Window)
' ...
Dim closer as EWindowClose
' ...
Method WhenClose(evt As EWindowClose)
    closer = evt
End Method
Listing 2: In the user module
' Set the window's close event handler
#w.WhenClose = Quit

Sub Quit Handles EWindowClose
    ' The "Handles" clause is like having
    ' Sub Quit(#win As Window)
End Sub

See also