NAME

TUI::Dialogs::ParamText - formatted dynamic text control for dialogs

HIERARCHY

TObject
  TView
    TStaticText
      TLabel
        TParamText

SYNOPSIS

use TUI::Dialogs;

my $bounds = TRect->new(ax => 1, ay => 1, bx => 30, by => 2);
my $paramText = TParamText->new( bounds => $bounds );

$paramText->setText('Value: %d, Name: %s', 42, 'John');

my $text = '';
$paramText->getText(\$text);

print "Current text: $text\n";

DESCRIPTION

TParamText is a dynamic text control derived from TStaticText. It allows formatted text to be displayed inside dialogs using printf-style format strings.

The control maintains an internal string buffer and recomputes its displayed text whenever setText is called. This mirrors the original Turbo Vision behavior, where formatted strings are generated using the FormatStr procedure.

TParamText is typically used for status messages, confirmations, or prompts that include variable data.

Commonly Used Features

In practice you will call new_TParamText to create the control, call setText once to supply the format string together with any arguments, and then insert the control into the dialog. Unlike the Pascal original, which required manually assigning a pointer to a parameter record, the Perl implementation accepts the format string and its arguments directly in setText, so no separate data structure needs to be maintained. When the dialog data changes you simply call setText again with the new values; getText is rarely needed outside of tests.

CONSTRUCTOR

new

my $paramText = TParamText->new(
  bounds => $bounds
);

Creates a new parameterized text control.

bounds

Bounding rectangle of the control (TRect).

new_TParamText

my $paramText = new_TParamText($bounds);

Factory-style constructor using positional arguments.

This constructor is provided for compatibility with traditional Turbo Vision construction patterns.

ATTRIBUTES

The following attributes are managed internally and exposed as read-only accessors.

str

Internal formatted text buffer (Str).

METHODS

getText

$paramText->getText(\$string);

Retrieves the current formatted text and writes it into the supplied scalar.

getTextLen

my $len = $paramText->getTextLen();

Returns the length of the formatted text currently stored in the buffer.

setText

$paramText->setText($format, @args);

Formats and stores text using a printf-style format string and triggers a redraw of the view.

SEE ALSO

TUI::Dialogs::StaticText, TUI::Dialogs::Label, TUI::Dialogs::Dialog

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).