NAME

TUI::Dialogs::InputLine - editable single-line text input control for dialogs

HIERARCHY

TObject
  TView
    TInputLine

SYNOPSIS

use TUI::Dialogs;

my $input = new_TInputLine($bounds, 64);
my $data = ['Hello'];
$input->setData($data);

DESCRIPTION

TInputLine implements a single-line editable text field for use in dialog boxes. It provides cursor movement, text insertion and deletion, selection, and horizontal scrolling when the visible field is smaller than the maximum allowed input length.

The control automatically handles keyboard and mouse input when it has focus. It is typically used for entering filenames, identifiers, or other short text values.

TInputLine supports optional validation through validator objects. By deriving from TInputLine and overriding validation and data transfer methods, applications can implement specialized input controls such as numeric or formatted fields.

VARIABLES

The following global variables affect the visual rendering of TInputLine.

$rightArrow

Defines the character used to indicate hidden text to the right of the visible input area. The default value is a CP437 character.

$leftArrow

Defines the character used to indicate hidden text to the left of the visible input area. The default value is a CP437 character.

ATTRIBUTES

The following attributes are part of the public state of the input line. Internal and private attributes are intentionally not documented.

data

Current text stored in the input field (Str).

maxLen

Maximum allowed length of the input text (Int).

curPos

Current cursor position within the text (Int).

firstPos

Index of the first visible character, used for horizontal scrolling (Int).

selStart

Start index of the current selection (Int).

selEnd

End index of the current selection (Int).

CONSTRUCTOR

new

my $input = TInputLine->new(
  bounds => $bounds,
  maxLen => $maxLen,
  validator => $validator
);

Creates a new input line control.

bounds

Bounding rectangle of the input field (TRect). The rectangle must describe a single-line area.

maxLen

Maximum number of characters the input field can hold (Int).

validator

Optional validator object used for input checking and data transfer (TValidator). This parameter may be omitted.

new_TInputLine

my $input = new_TInputLine($bounds, $maxLen, | $validator);

Factory-style constructor using positional arguments.

This constructor is equivalent to calling new with named parameters and is provided for compatibility with traditional Turbo Vision construction patterns.

DESTRUCTOR

DEMOLISH

$self->DEMOLISH($in_global_destruction);

Destroys the input line and releases associated resources. This method corresponds to the Turbo Vision destructor and is normally invoked automatically.

METHODS

dataSize

my $size = $input->dataSize();

Returns the number of elements required to store the control's data.

For TInputLine, this value is 1, since the input text is transferred as a single element when using getData and setData.

draw

$input->draw();

Draws the input line, including text, cursor, selection, and scroll indicators.

getData

$input->getData(\$record);

Copies the current input text into the supplied record.

getPalette

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

Returns the color palette used to draw the input line.

handleEvent

$input->handleEvent($event);

Processes keyboard and mouse events for editing, selection, and navigation.

selectAll

$input->selectAll($enable);

Selects or clears the entire input text depending on $enable.

setData

$input->setData(\$record);

Replaces the current input text using the supplied record and selects the text.

setState

$input->setState($state, $enable);

Updates the view state and performs additional processing specific to input lines.

setValidator

$input->setValidator($validator);

Installs or replaces the validator object used for input checking.

SEE ALSO

TUI::Dialogs::Dialog, TUI::Dialogs::Label, TUI::Dialogs::History, TUI::Validators::Validator

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