LibUI::Entry - Single Line Text Entry Field Suitable for Sensitive Input
use LibUI ':all'; use LibUI::VBox; use LibUI::Window; use LibUI::SearchEntry; Init( { Size => 1024 } ) && die; my $window = LibUI::Window->new( 'Hi', 320, 100, 0 ); my $box = LibUI::VBox->new(); my $pass = LibUI::SearchEntry->new; $box->append( $pass, 0 ); $pass->onChanged( sub { warn 'Query: ' . shift->text }, undef ); $window->setChild($box); $window->onClosing( sub { Quit(); return 1; }, undef ); $window->show; Main();
A LibUI::SearchEntry object represents a control with a single line text entry field.
Some systems will deliberately delay the onChanged( ... ) callback for a more natural feel.
onChanged( ... )
This is a subclass of LibUI::Entry.
Not a lot here but... well, it's just a text box.
new( ... )
my $txt = LibUI::SearchEntry->new( );
Creates a new entry.
$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
$txt
$data
Note: The callback is not triggered when calling setText( ... ).
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.
$txt->setText( 'Updated' );
Sets the entry's text.
text( ... )
warn $txt->text( );
Returns the entry's text.
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Sanko Robinson <sanko@cpan.org>
To install LibUI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LibUI
CPAN shell
perl -MCPAN -e shell install LibUI
For more information on module installation, please visit the detailed CPAN module installation guide.