Return to index

tui functions

string = editor(default_content_string,width,height,title_string)

top

Launches a multiline text editor and returns the edited string


tui_struct = selector(array[,map])

top

present selection menu at current cursor position

Example:

# Example for selector
try
    println selector([])
catch err
    println "selector not available"
endtry


result = tui(map[,map])

top

perform tui action

Example:

# Example for tui
try
    tui_new()
    tui("Hello World")
    tui_clear()
catch err
    println "TUI not available"
endtry


tui_box(map[,map])

top

draw box

Example:

# Example for tui_box
try
    tui_new()
    tui_box(0, 0, 10, 5)
catch err
    println "TUI not available"
endtry


tui_clear(map[,map])

top

clear a tui element's area

Example:

# Example for tui_clear
try
    tui_new()
    tui_clear()
catch err
    println "TUI not available"
endtry


string = tui_input(map[,map])

top

input text. relevant tui struct fields: .Border, .Content, .Prompt, .Cursor, .Title, .Width, .Height, .Row, .Col

Example:

# Example for tui_input
try
    tui_new()
    println tui_input("Enter name:", "")
catch err
    println "TUI not available"
endtry


int_selection_position = tui_menu(map[,map])

top

present menu

Example:

# Example for tui_menu
try
    tui_new()
    println tui_menu(["Option 1", "Option 2"])
catch err
    println "TUI not available"
endtry


map = tui_new()

top

create a tui options map

Example:

# Example for tui_new
try
    tui_new()
catch err
    println "TUI not available"
endtry


map = tui_new_style()

top

create a tui style map

Example:

# Example for tui_new_style
try
    tui_new_style("bold")
catch err
    println "TUI not available"
endtry


tui_pager(map[,map])

top

pager for text

Example:

# Example for tui_pager
try
    tui_new()
    tui_pager("Line 1\nLine 2\nLine 3")
catch err
    println "TUI not available"
endtry


tui_progress(map[,map])

top

update a progress bar

Example:

# Example for tui_progress
try
    tui_new()
    tui_progress(50, 100)
catch err
    println "TUI not available"
endtry


tui_progress_reset(map)

top

reset a progress bar

Example:

# Example for tui_progress_reset
try
    tui_new()
    tui_progress_reset()
catch err
    println "TUI not available"
endtry


tui_radio(map[,map])

top

checkbox selector

Example:

# Example for tui_radio
try
    tui_new()
    println tui_radio(["Yes", "No"])
catch err
    println "TUI not available"
endtry


tui_screen(int)

top

switch to primary (0) or secondary (1) screen buffer

Example:

# Example for tui_screen
try
    tui_new()
    tui_screen(10, 5)
catch err
    println "TUI not available"
endtry


tui_table(map[,map])

top

table formatter (.Format="csv|tsv|psv|ssv|custom|aos" .Data=input string


tui_result = tui_table_select(map[,map])

top

interactive table row selector. Returns .Result=selected row index, .Cancel=true if aborted. Supports select_bg/select_fg in style.

Example:

# Example for tui_table_select
try
    tui_new()
    println tui_table_select(["Col1", "Col2"], [["a", 1], ["b", 2]])
catch err
    println "TUI not available"
endtry


tui_template(map[,map])

top

replace {.field} matches in template string, with struct field values

Example:

# Example for tui_template
try
    tui_new()
    tui_template("Hello {{name}}", map(.name "World"))
catch err
    println "TUI not available"
endtry


tui_text(map[,map])

top

output text

Example:

# Example for tui_text
try
    tui_new()
    tui_text(0, 0, "Hello")
catch err
    println "TUI not available"
endtry