Event Handling
- Source: https://www.freebasic.net/wiki/wikka.php?wakka=ProPgEventHandling
- Last revised: 2022-06-07
Handling (querying and processing) keyboard, mouse, and window Events.
Preamble:
Events are basically user actions like key press, clicks, mouse movements, etc., or some occurrence like system generated notifications.
The Event type plus the ScreenEvent function constitute a built-in interface provided by FreeBASIC for accessing events (keyboard, mouse, and window events).
ScreenEvent signals the events so the user can write his own event handlers (which require that he keeps track of the data himself).
By using ScreenEvent, the user can check the events as they are returned by the function.
It is assumed that this function is regularly called to fetch events as they are queued internally by the system.
Event type
The Event type is a pre-defined structure in "fbgfx.bi" (in the FB Namespace for the lang fb dialect only).
When the user calls ScreenEvent passing an instance of Event type, ScreenEvent fills in it with the event data (if an event flag is returned).
Syntax
#include once "fbgfx.bi"
Using FB
Dim variable As Event"Event" structure
This structure is extracted from "fbgfx.bi".
start GeSHi
Type EVENT Field = 1
Type As Long
Union
Type
scancode As Long
ascii As Long
End Type
Type
x As Long
y As Long
dx As Long
dy As Long
End Type
button As Long
z As Long
w As Long
End Union
End Typeend GeSHi
.typefield contains the event type ID value corresponding to one of the following symbols defined in "fbgfx.bi":