1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#!/usr/bin/perl
use v5.14;
use warnings;
use Tickit;
use Tickit::Widgets qw( Entry VBox Scroller );
use Tickit::Widget::Scroller::Item::Text;
use Tickit::Widget::Entry::Plugin::Completion;
my $vbox = Tickit::Widget::VBox->new(
spacing => 1,
);
$vbox->add(
my $scroller = Tickit::Widget::Scroller->new,
expand => 1,
);
my @words = qw( zero one two three four five six seven eight nine ten );
push @words, qw( eleven twelve );
$scroller->push(
Tickit::Widget::Scroller::Item::Text->new( $_ )
) for @words;
$vbox->add(
my $entry = Tickit::Widget::Entry->new(
style => { bg => "blue" },
on_enter => sub {
my ( $entry, $line ) = @_;
},
),
);
Tickit::Widget::Entry::Plugin::Completion->apply( $entry,
# completion-related args here?
words => \@words,
);
Tickit->new( root => $vbox )->run;
|