BlitzMax/Modules/Events/Events

Event objects are used to notify your application about external events such as user input, user interface activity and so on.

The are two main ways your program can receive events: either by adding a hook function to the EmitEventHook hook, or by using using the global event queue

The most important field in an event object is the id field, which identifies the kind of event:

=Globals=

EmitEventHook
Global EmitEventHook=AllocHookId

Description: Hook id for emitted events

Information: The EmitEventHook global variable contains a hook id for use with AddHook.

Each time EmitEvent is called, the event is passed to all EmitEventHook hook functions by means of the hook function data parameter.

=Types=

TEvent
Event object type


 * id
 * source
 * data
 * mods
 * x
 * y
 * extra


 * Emit
 * ToString


 * Create
 * AllocUserId

TEvent: Fields
Field id

Description: Event identifier

Field source:Object

Description: Event source object

Field data

Description: Event specific data

Field mods

Description: Event specific modifiers

Field x

Description: Event specific position data

Field y

Description: Event specific position data

Field extra:Object

Description: Event specific extra information

TEvent: Methods
Method Emit

Description: Emit this event

Information: This method runs all EmitEventHook hook function, passing Self as the hook data.

Method ToString$

Description: Convert event to a string

Information: This method is mainly useful for debugging purposes.

TEvent: Functions
Function Create:TEvent( id,source:Object=Null,data=0,mods=0,x=0,y=0,extra:Object=Null )

Description: Create an event object

Returns: A new event object

Function AllocUserId

Description: Allocate a user event id

Returns: A new user event id

=Functions=

EmitEvent
Function EmitEvent( event:TEvent )

Description: Emit an event

Information: Runs all EmitEventHook hooks, passing event as the hook data.

CreateEvent
Function CreateEvent:TEvent( id,source:Object=Null,data=0,mods=0,x=0,y=0,extra:Object=Null )

Description: Create an event object

Returns: A new event object

AllocUserEventId
Function AllocUserEventId( description$="" )

Description: Allocate a user event id

Returns: A new user event id