Skip to content

PeekEvent

Claude edited this page Oct 27, 2026 · 4 revisions
BlitzPlus

PeekEvent

PeekEvent:Int32

Returns: The kind of the next event, or 0 if there is none.

Description

Looks at the next event without taking it. If one is waiting it gives the kind, and if not it gives 0. The event stays in the queue, and EventID and the other event functions do not change, so use WaitEvent with a timeout of 0 to actually take it.

Calling it also lets the windows do their work, so it can be used to keep the interface alive in a loop that does other things.

Examples

Graphics 320, 240, 32, 2
win = CreateWindow("Busy", 20, 20, 240, 100, Desktop(), 15)
n = 0
While PeekEvent() <> $803
	n = n + 1
	SetStatusText win, "Looped " + n + " times"
	If PeekEvent() Then WaitEvent(0)
	Delay 10
Wend

Related Commands

EventData, EventID, EventSource, EventX, EventY, EventZ, WaitEvent

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally