Skip to content

Modern Tui TuiApp Shutdown

Paul Squires edited this page Nov 9, 2026 · 7 revisions

Home › Terminal TUI Library › Application Loop › TuiApp.Shutdown

TuiApp.Shutdown

Runs once as the loop ends, while the terminal is still taken.

Syntax

TuiApp.Shutdown( )

Description

Called once as the loop exits, including on the early-exit path where Init returned TuiQuit. The terminal is still active at that point; ordinary PRINT becomes safe only after TuiRun returns.

Example

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

type Closer extends TuiApp
    declare function Init( ) as TuiCmd override
    declare function Update( byref e as TuiEvent ) as TuiCmd override
    declare sub View( byref f as TuiFrame ) override
    declare sub Shutdown( ) override
end type

sub Closer.Shutdown( )
    '' flush your own state here. Do NOT print: the alternate screen is
    '' still up and on Linux and macOS a stray PRINT can emit CSI 6n and block.
end sub

See also

TuiApp TuiApp.Update TuiCmd TuiRedraw TuiTick TuiSuspend
TuiApp.Init TuiApp.View TuiNone TuiQuit TuiInvalidate TuiRun

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


Home · Keyword Index

Clone this wiki locally