Skip to content

Modern Tui TuiMessageBox

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

Home › Terminal TUI Library › Overlays and Chrome › TuiMessageBox

TuiMessageBox

Draws a dialog with a title, a message and buttons, coloured by its kind.

Syntax

type TuiMessageBox extends TuiWidget
    as ustring title, message
    as TuiStringArray buttons
    as int32 selected
    as uint8 msgKind
    as TuiTheme theme
end type

Description

A modal dialog with buttons. msgKind is TUIMSG_INFO, _WARNING, ERROR or QUESTION and picks the accent colour; ERROR carries the underscore because ERROR is an intrinsic. Ask Accepted or Cancelled after handing it an event.

Example

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

dim as TuiMessageBox mb
mb.title = "Confirm"
mb.message = "Submit the form?"
mb.buttons.Push( "Yes" )
mb.buttons.Push( "No" )
mb.selected = 0
mb.msgKind = TUIMSG_QUESTION
mb.theme = TuiThemeDefault( )

dim as TuiEvent e
e.kind = TUIEVENT_KEY : e.key.code = TUIKEY_ENTER
mb.HandleEvent( e )
print mb.Accepted( )              '' true -- "Yes" was selected
print mb.Cancelled( )             '' false

See also

TuiPopup TuiMenu TuiStatusItem TuiStatusBar.Add
TuiMessageBox.Accepted TuiMenuBar TuiStatusItemOf TuiTreeNode
TuiMessageBox.Cancelled TuiMenuBar.IsOpen TuiStatusBar TuiTreeState

Library: Terminal TUI Library
Category: Terminal TUI Library
Documented under: Overlays and Chrome
Working examples: hello.tiko · form.tiko · dashboard.tiko


Home · Keyword Index

Clone this wiki locally