NAME
TUI::Editors::Memo - multi-line text editor view for dialog data
HIERARCHY
TObject
TView
TEditor
TMemo
SYNOPSIS
use TUI::Objects;
use TUI::Editors;
use TUI::Dialogs;
my $memo = TMemo->new(
bounds => TRect->new( ax => 0, ay => 0, bx => 40, by => 8 ),
hScrollBar => undef,
vScrollBar => $vScrollBar,
indicator => undef,
bufSize => 0,
);
$dialog->insert( $memo );
my @rec = ();
$memo->getData( \@rec );
my $text = $rec[1];
DESCRIPTION
TMemo is a TEditor that takes part in the data transfer of a dialog. Its data record is an array-like value whose first element is the length and whose second element is the text of the buffer. A "TMemoData" object can be used as this record.
getData stores the current text in the record, and setData replaces the text with the text of the record. A Tab key press is not handled by the memo, so the Tab key moves the focus to the next view of the dialog.
The text buffer of TEditor is a plain Perl string, so the Turbo Vision buffer size of TMemoData is not needed. The data record therefore has two entries: the length and the text.
ATTRIBUTES
TMemo has no attributes of its own. The attributes are inherited from TEditor.
CONSTRUCTOR
new
my $memo = TMemo->new(
bounds => $bounds,
hScrollBar => $hScrollBar | undef,
vScrollBar => $vScrollBar | undef,
indicator => $indicator | undef,
bufSize => $bufSize,
);
Creates a new memo view. The constructor is the same as the constructor of TEditor, so bufSize is required.
new_TMemo
my $memo = new_TMemo(
$bounds,
$hScrollBar | undef,
$vScrollBar | undef,
$indicator | undef,
$bufSize,
);
Factory-style constructor using positional arguments.
METHODS
getData
$memo->getData( \@rec );
$memo->getData( TMemoData->new() );
Stores the buffer length in $rec->[0] and the text in $rec->[1]. $rec must be an array-like value (ArrayLike): a plain array reference or an object based on an array, such as a "TMemoData" object.
setData
$memo->setData( \@rec );
$memo->setData( TMemoData->new( length => 5, buffer => 'hello' ) );
Replaces the text with $rec->[1], truncated to $rec->[0] characters, and sets the buffer length to the length of the new text. $rec must be an array-like value (ArrayLike), as for "getData".
getPalette
my $palette = $memo->getPalette();
Returns the palette cpMemo, which differs from the palette of TEditor.
handleEvent
$memo->handleEvent( $event );
Ignores a kbTab key down event. All other events are passed to TEditor.
STRUCTURES
TMemoData
my $data = TMemoData->new( length => 5, buffer => 'hello' );
An optional data record of the memo, built with Class::Struct as an array reference. It has the attributes length and buffer, which are the elements [0] and [1] of the record. It is a convenience only; any array-like value can be used with "getData" and "setData".
SEE ALSO
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).