Skip to content

Turbo Vision for Rust

The Borland text-mode UI framework, rebuilt in Rust. Menus, windows, dialogs, validators, editors and palettes, drawn in a terminal, on a desktop that still looks like 1991.

Get started What's new Browse the user guide

A shrink-wrapped 1990s software box reading Turbo Vision, Text-Mode UI Framework, version 4.2, with 42 examples, MIT licensed, on crates.io, a screenshot of a Calendar, a Puzzle, a Calculator and an ASCII table with an About dialog on top, and a yellow starburst sticker reading Now For Rust

What it gives you

The crate is a full port of Borland's class library, not a lookalike. The class tree TView → TGroup → TWindow → TDialog survives as a stack of Rust traits, the event model is the same three-phase dispatch, the palettes are the original Borland colour tables, and the commands still start at cmQuit. If you wrote Turbo Vision in Pascal or C++ you already know most of this library.

  • An application shell

    A menu bar, a status line, a desktop with draggable, resizable, shadowed windows, and a modal loop that behaves like TProgram::run.

  • Real controls

    Input lines, buttons, check boxes, radio buttons, list boxes, combo boxes, scroll bars, trees, tables, split panes, progress bars, sliders, tooltips and history dropdowns. Tables and list boxes can also read their rows from a lazy source instead of holding them all in memory, and tables can freeze their first rows and columns like a spreadsheet.

  • Validators

    Filter, range and picture validators, wired into input lines the way Borland wired them, so a dialog refuses to close on bad data.

  • An editor

    A text editor view with selection, clipboard, undo and syntax highlighting, plus the file-open and change-directory dialogs that go with it.

  • The Borland palettes

    The palette chain is pushed down the view tree at draw time, so a control picks up its colour from the window that owns it, exactly as the original did.

  • Translations

    Every string the library shows is a Project Fluent message, shipped in English, Spanish and Catalan. Your application adds its own messages and languages, switches language while it runs, and tests its translation files. Dialogs size themselves to the translated text. See Chapter 19. Contributed by Antoni Aloy.

  • A terminal layer

    A Backend trait with a crossterm implementation and a mock terminal your tests can draw into and read cells back from. An SSH server, remote input over TCP, Kitty/ANSI graphics and a log window live in the companion tv-extensions crate.

Thirty seconds of code

use turbo_vision::core::status_data::StatusItemBuilder;
use turbo_vision::prelude::*;
use turbo_vision::views::status_line::StatusLine;

fn main() -> turbo_vision::core::error::Result<()> {
    let mut app = Application::new()?;

    let (w, h) = app.terminal.size();
    app.set_status_line(StatusLine::new(
        Rect::new(0, h as i16 - 1, w as i16, h as i16),
        vec![
            StatusItemBuilder::new()
                .text("~Alt-X~ Exit")
                .key("Alt+X")
                .command(CM_QUIT)
                .build(),
        ],
    ));

    app.run();
    Ok(())
}

Where to go next

If you want to Read
Build your first application Getting started then Chapter 1
Follow a complete worked project The biorhythm calculator tutorial
Understand the trait layering Views and groups, the class diagram and the design document
Port a C++ Turbo Vision program The application model, side by side
Translate your application Chapter 19, Localization
See what changed recently What's new
Move an existing project onto 4.0.0 The 4.0 upgrade guide
Move an existing project onto 3.0.0 The 3.0 upgrade guide

It looks like this

A Pascal source file open in the editor, with syntax highlighting and a breakpoint gutter

A dialog of validated input fields: digits only, numeric ranges and picture masks

Tabbed pages of new controls, with combo boxes, a spinner and a progress bar

A biorhythm chart drawn in coloured text cells

Credits

Built by Enzo Lombardi, from Borland's original Turbo Vision 2.0 and the kloczek C++ port. MIT licensed.

Translations, in 4.2, are the work of Antoni Aloy, who also gave Table cell formats and fixed a long run of bugs with accented text and message boxes. Thank you.