NAME
LibUI::MultilineEntry - Multiline Text Entry Field
SYNOPSIS
use LibUI ':all';
use LibUI::VBox;
use LibUI::Window;
use LibUI::MultilineEntry;
Init && die;
my $window = LibUI::Window->new( 'Notepadish', 320, 100, 0 );
$window->setMargined( 1 );
my $box = LibUI::VBox->new();
my $text = LibUI::MultilineEntry->new();
$box->append( $text, 1 );
$text->onChanged( sub { warn sprintf '%d chars', length shift->text; }, undef );
$window->setChild($box);
$window->onClosing(
sub {
Quit();
return 1;
},
undef
);
$window->show;
Main();
DESCRIPTION
A control with a multi line text entry field.
Functions
Not a lot here but... well, it's just a simple widget.
new( )
my $text = LibUI::MultilineEntry->new( );
Creates a new multi line entry that visually wraps text when lines overflow.
append( ... )
$text->append(qq[-- \nJohn Smith\nsmithj\@work.email]);
Appends text to the multi line entry's text.
onChanged( ... )
$date->onChanged(
sub {
my ($ctrl, $data) = @_;
warn $ctrl->text;
}, undef);
Registers a callback for when the user changes the multi line entry's text.
Expected parameters include:
$callback
- CodeRef that should expect the following:$data
- user data to be passed to the callback
Note: The callback is not triggered when calling setText( ... )
or append( ... )
.
readonly( )
if( $text->readonly ) {
...;
}
Returns whether or not the multi line entry's text can be changed.
setReadonly( ... )
$text->setReadonly( 1 );
Sets whether or not the multi line entry's text is read only.
text( )
warn $date->text;
Returns the multi line entry's text.
setTime( ... )
$date->setTime( 'We need to get to work.' );
Sets the multi line entry's text.
See Also
LibUI::Entry - Single line text field
LibUI::NonWrappingMultilineEntry - Multi-line text file that does not wrap
LICENSE
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Sanko Robinson <sanko@cpan.org>