Event Statement

Defines the signature for an event handler.

Syntax

Event event_name [ parameter_list ]

Parts

event_name
Necessary name for the event
parameter_list
Zero or more variable declarations between optional rounded brackets with a comma between each declaration.

Instructions

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.

Examples

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)
    #win.Close()
End Sub

See also