NAME

TUI::Menus::StatusLine - defines the class TStatusLine

HIERARCHY

TObject
  TView
    TStatusLine

DESCRIPTION

TStatusLine represents the message line displayed at the bottom of a Turbo Vision application. It shows context-sensitive key hints and status messages associated with menu items and commands.

A status line is typically created during application initialization and is updated automatically as the active help context changes. Internally, the status line selects an appropriate status definition and renders the corresponding status items.

In addition to displaying key bindings, TStatusLine can provide short, context-sensitive hints that vary depending on the currently active menu or view. This behavior is commonly customized by overriding the hint method in a subclass.

VARIABLES

The following global variable affects the visual rendering of TStatusLine.

$hintSeparator

Defines the character sequence used to separate individual hints in the status line. The default value uses a CP437 vertical separator.

ATTRIBUTES

The following attributes are exposed as read-only accessors and are intended for internal use by the status line implementation.

defs

Read-only reference to the linked list of status definitions (TStatusDef). This attribute is required and defines which status items apply to which help context ranges.

items

Read-only reference to the currently active list of status items (TStatusItem). This list is managed internally and updated as the help context changes.

METHODS

new

my $obj = TStatusLine->new(
  bounds => $bounds,
  defs   => $defs
);

Creates a new status line object at the position specified by $bounds and initializes it with a list of status definitions.

bounds

Bounding rectangle of the status line (TRect). The height is typically one row and the line is placed at the bottom of the desktop.

defs

Status definition list associated with this status line (TStatusDef). This parameter is required.

new_TStatusLine

my $obj = new_TStatusLine($bounds, $aDefs | undef);

Factory constructor for creating a status line instance.

DEMOLISH

$self->DEMOLISH($in_global_destruction);

Performs cleanup of the status line object and disposes of associated resources. This method is normally called automatically by the owning view or application.

disposeItems

$self->disposeItems($item | undef);

Releases the current list of status items. This method is used internally during updates and cleanup.

draw

$self->draw();

Draws the status line using the currently active status items and any context-sensitive hint text.

getPalette

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

Returns the color palette used to draw the status line. Subclasses may override this method to provide alternative color mappings.

handleEvent

$self->handleEvent($event);

Processes mouse and keyboard events occurring on the status line. When a status item is selected, the corresponding command is generated and dispatched.

hint

my $str = $self->hint($aHelpCtx);

Translates a help context identifier into a short hint string that is displayed on the status line.

This method is intended to be overridden in subclasses to provide application-specific, context-sensitive help text. The default implementation returns an empty string.

update

$self->update();

Updates the status line contents based on the current help context. This method selects the appropriate status definition and rebuilds the list of visible status items.

EXAMPLE

The following example shows a typical status line definition using chained status items and a single status definition that applies to all help contexts.

sub initStatusLine {
  my ( $class, $bounds ) = @_;

  $bounds->{a}{y} = $bounds->{b}{y} - 1;

  return new_TStatusLine(
    $bounds,
    new_TStatusDef( 0, 0xFFFF )
      + new_TStatusItem( '~Alt+X~ Exit', kbAltX, cmQuit )
      + new_TStatusItem( '~F10~ Menu', kbF10, cmMenu )
      + new_TStatusItem( '~F1~ Help', kbF1, cmHelp )
  );
}

This pattern mirrors the traditional Turbo Vision status line construction while using Perl-specific operator overloading for clarity.

SEE ALSO

TUI::Menus::StatusDef, TUI::Menus::StatusItem

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) 2025-2026 the "AUTHORS" as listed above.

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