Blitz3D+ Command Reference

EventID ( )

Parameters

None.

Description

Returns the id of the current event - the one WaitEvent or PeekEvent last fetched.

Requires Extended language mode.

The id tells you what kind of thing happened, and the values group into hex families:

$101-$103: key down, key up, key character
$201-$206: mouse down, up, move, wheel, enter, leave
$401: gadget action (a click, a change, an edit)
$402: gadget activate (keyboard focus arrived)
$801-$804: window move, size, close, activate
$1001: menu action
$2001-$2005: application suspend, resume, display change, begin modal, end modal
$4001: timer tick

The classic loop shape is a Select over it:

Select WaitEvent()
    Case $401 ; a gadget did something - check EventSource
    Case $803 ; user clicked the window's close button
End Select

EventID and the other Event commands keep reporting the same event until the next WaitEvent or PeekEvent call replaces it - and note that WaitEvent already returned this same id, so many loops never need EventID at all.

A window close ($803) is a request, not an act: the window stays open until you decide to FreeGadget it, which is what lets you ask "Save changes?" first.

See the menus and events sample and the world editor shell sample for full event loops.

See also: WaitEvent, PeekEvent, EventData, EventSource, EventX, FlushEvents.

Index