NAME

TUI::Dialogs::Dialog - base dialog window class for Turbo Vision dialogs

HIERARCHY

TObject
  TView
    TGroup
      TWindow
        TDialog

SYNOPSIS

use TUI::Dialogs;
use TUI::Objects;

my $bounds = TRect->new(
  ax => 5, ay => 3,
  bx => 40, by => 15
);

my $dialog = TDialog->new(
  bounds => $bounds,
  title  => 'Example'
);

my $result = $deskTop->execView($dialog);

DESCRIPTION

TDialog implements the fundamental dialog window class used throughout Turbo Vision. Dialogs provide a modal or non-modal container for controls such as buttons, input fields, checkboxes, and labels.

The dialog class manages palette selection, keyboard handling for dialog acceptance or cancellation, focus traversal, and modal termination logic. It forms the basis for all higher-level dialog implementations.

Dialogs are typically executed modally using execView on the desktop, but may also be inserted directly as non-modal windows.

ATTRIBUTES

The following attributes are inherited from TWindow and managed internally.

growMode

Window growth behavior flag inherited from TWindow (Int).

flags

Internal flag mask controlling movement and closing behavior (Int).

palette

Identifier of the dialog palette used for rendering (Int).

CONSTRUCTOR

new

my $dialog = TDialog->new(
  bounds => $bounds,
  title  => $title
);

Creates a new dialog window.

bounds

Bounding rectangle defining the dialog position and size (TRect).

title

Title string displayed in the dialog frame (Str).

new_TDialog

my $dialog = new_TDialog($bounds, $title);

Factory-style constructor using positional arguments.

METHODS

getPalette

my $palette = $dialog->getPalette();

Returns a clone of the palette associated with the dialog color scheme.

Subclasses may override this method to provide custom color mappings.

handleEvent

$dialog->handleEvent($event);

Processes keyboard and command events.

This method adds dialog-specific handling for keys such as Escape and Enter and generates standard dialog commands like cmCancel or cmDefault.

valid

my $bool = $dialog->valid($command);

Checks whether the dialog should accept the specified command.

The cancel command (cmCancel) is always accepted. For validation commands, this method queries all contained controls to determine whether the dialog state is valid.

SEE ALSO

TUI::Dialogs::Button, TUI::Dialogs::InputLine, TUI::Dialogs::CheckBoxes, TUI::Dialogs::RadioButtons, TUI::Views::Window, TUI::App::DeskTop

AUTHORS

Borland International (original Turbo Vision design)
J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)

COPYRIGHT AND LICENSE

Copyright (c) 1990-1994, 1997 by Borland International

Copyright (c) 2026 the "AUTHORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).