NAME

LibUI::Entry - Single Line Text Entry Field

SYNOPSIS

use LibUI ':all';
use LibUI::VBox;
use LibUI::Window;
use LibUI::Entry;
Init && die;
my $window = LibUI::Window->new( 'Hi', 320, 100, 0 );
$window->setMargined( 1 );
my $box    = LibUI::VBox->new();
my $entry  = LibUI::Entry->new;
$box->append( $entry, 0 );
$entry->onChanged( sub { warn shift->text }, undef );
$window->setChild($box);
$window->onClosing(
    sub {
        Quit();
        return 1;
    },
    undef
);
$window->show;
Main();

DESCRIPTION

A LibUI::Entry object represents a control with a single line text entry field.

Functions

Not a lot here but... well, it's just a text box.

new( ... )

my $txt = LibUI::Entry->new( );

Creates a new entry.

onChanged( ... )

$txt->onChanged(
sub {
    my ($ctrl, $data) = @_;
    warn $ctrl->text;
}, undef);

Registers a callback for when the user changes the entry's text.

Expected parameters include:

$callback - CodeRef that should expect the following:
$txt - backreference to the instance that initiated the callback
$data - user data registered with the sender instance
$data - user data to be passed to the callback

Note: The callback is not triggered when calling setText( ... ).

readonly( ... )

if( $txt->readonly( ) ) {
    ...;
}

Returns whether or not the entry's text can be changed.

setReadonly( ... )

$txt->setReadonly( 1 );

Sets whether or not the entry's text is read only.

setText( ... )

$txt->setText( 'Updated' );

Sets the entry's text.

text( ... )

warn $txt->text( );

Returns the entry's text.

See Also

LibUI::PasswordEntry, LibUI::SearchEntry.

LibUI::MultilineEntry - Multi-line text file that does not wrap

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>