Skip to content

Modern Tui TuiInput NextEvent

Paul Squires edited this page Oct 19, 2026 · 6 revisions

Home › Terminal TUI Library › Events › TuiInput.NextEvent

TuiInput.NextEvent

Returns the next complete event, or no value yet; a lone Esc waits for a timeout.

Syntax

TuiInput.NextEvent( byval escExpired as boolean = FALSE ) as TuiEventOpt

Description

The next complete event, or nothing. ESC IS AMBIGUOUS and always will be: a lone Esc and the start of a CSI sequence are the same byte, so the parser holds it until more bytes arrive or you pass escExpired to say the timeout elapsed.

Example

#import "std/tui"
using tui

dim as TuiInput keys
keys.Feed( chr( 27 ) )
print keys.NextEvent( FALSE ).HasValue( )  '' false -- might be a sequence
print keys.WaitingOnLoneEsc( )             '' true

'' the timeout fired: it really was a lone Esc
print keys.NextEvent( TRUE ).Value( ).key.code = TUIKEY_ESCAPE '' -1 (true)

See also

TuiEvent TuiKey.IsChar TuiMouse TuiInput TuiInput.PushEvent TuiInput.Buffered
TuiKey TuiKey.HasMod TuiKeyName TuiInput.Feed TuiInput.Reset TuiInput.Queued

Library: Terminal TUI Library
Category: Terminal TUI Library
Documented under: Events
Working examples: hello.tiko · form.tiko · dashboard.tiko


Home · Keyword Index

Clone this wiki locally