Skip to content

Modern Tui TuiWidget HandleEvent

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

Home › Terminal TUI Library › Widgets › TuiWidget.HandleEvent

TuiWidget.HandleEvent

Offers an event to the widget and returns true if the widget used it.

Syntax

TuiWidget.HandleEvent( byref e as TuiEvent ) as boolean

Description

Returns TRUE when the event was CONSUMED. A container offers the event to its focused child first and only acts if the child declined -- which is how Tab reaches the focus ring but an arrow key inside a text input does not.

Example

#import "std/numeric"
#import "std/tui"
using tui, numeric

dim as TuiListState st
dim as TuiList lst
lst.items.Push( "a" ) : lst.items.Push( "b" ) : lst.items.Push( "c" )
lst.state = @st
lst.SetFocused( TRUE )

dim as TuiEvent e
e.kind = TUIEVENT_KEY : e.key.code = TUIKEY_DOWN
print lst.HandleEvent( e )        '' true -- consumed
print st.selected                 '' 1

e.key.code = TUIKEY_F9
print lst.HandleEvent( e )        '' false -- not ours; pass it on

See also

TuiWidget TuiWidget.SizeHint TuiFocusRing TuiFocusRing.Count
TuiWidget.Render TuiWidget.CanFocus TuiFocusRing.Add TuiFocusRing.Current
TuiWidget.Kind TuiWidget.SetFocused TuiFocusRing.Clear TuiFocusRing.Next_

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


Home · Keyword Index

Clone this wiki locally