Skip to content

WaitEvent

Narta Xaymar Dirks edited this page Oct 28, 2026 · 5 revisions
BlitzPlus

WaitEvent

WaitEvent:Int32 timeout:Int32=-1
Parameter Mode Type Default Description
timeout In Int32 -1 Longest time to wait in milliseconds. -1 waits forever, 0 does not wait. Defaults to -1.

Returns: The kind of the event, or 0 if the time ran out.

Description

Waits until something happens and gives the kind of event. Use EventData, EventSource, EventX and the others to learn more about it. While it waits the windows keep working and are redrawn.

A program with windows is built around a loop with WaitEvent. Take every event from one call: calling it again before you read the values throws the earlier event away.

Examples

Graphics 320, 240, 32, 2
win  = CreateWindow("Timeout", 20, 20, 260, 120, Desktop(), 3)
info = CreateLabel("Waiting", 10, 10, 230, 40, win)
Repeat
	e = WaitEvent(500)
	If e = 0 Then SetGadgetText info, "Nothing for 500 ms"
Until e = $803

Media

WaitEvent

Related Commands

EventData, EventID, EventSource, EventX, EventY, EventZ, PeekEvent

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally