Skip to content

Modern Tui TuiFrame DrawText

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

Home › Terminal TUI Library › Buffer and Frame › TuiFrame.DrawText

TuiFrame.DrawText

Draws a string at a cell and returns the number of columns it used.

Syntax

TuiFrame.DrawText( byval x as int32, byval y as int32, byref s as ustring, byval st as TuiStyle ) as int32

Description

Draws a string and returns the COLUMNS it advanced -- not the character count, which is what you add to x to place the next thing. A wide glyph advances 2 and a combining mark advances 0.

Example

#import "std/tui"
using tui

dim as TuiScreen scr
scr.Resize( 40, 4 )
dim as TuiFrame ptr f = scr.BeginFrame( )

dim as int32 adv = f->DrawText( 0, 0, "hello", TuiStyleDefault( ) )
print adv                         '' 5

'' the shape for laying out a row of pieces
dim as int32 x = 0
x += f->DrawText( x, 1, "name: ", TuiStyleDefault( ) )
x += f->DrawText( x, 1, "quinn",  TuiStyleDefault( ) )
print x                           '' 11

See also

TuiCell TuiCell.Equals TuiBuffer TuiBuffer.Clear TuiBuffer.At TuiFrame
TuiCell.SetChar TuiCellBlank TuiBuffer.Resize TuiBuffer.InBounds TuiBuffer.Count TuiFrame.Area

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


Home · Keyword Index

Clone this wiki locally