Tui
view release on metacpan or search on metacpan
} elsif ($self->{exitonaltx} && $keycode == 19) {
$result = 9;
last;
} elsif ($self->{exitonalth} && $keycode == 18) {
$result = 10;
last;
} elsif ($self->{exitonaltenter} && $keycode == 50) {
$result = 11;
last;
} elsif ($self->{exitonenter} && $keycode == 200 && $key eq "\n") {
$result = 12;
last;
} elsif ($keycode == 200 && $key =~ /[ \n]/) {
${$self->{entriesstat}}[$self->{pos}] =
${$self->{entriesstat}}[$self->{pos}] ? 0 : 1;
}
$self->draw(1);
refresh($self->{win});
}
$self->draw;
refresh($self->{win});
return $result;
}
=head2 Tui::Mlistbox::data
Return a list of indeces of the selected entries
=over 2
=item Input Paramters
1 none
=item Ouput Parameters
1 list of selected entries (the index of them!)
=back
=cut
sub data {
my ($self) = shift;
my (@list) = ();
foreach (0..$#{$self->{entries}}) {
if (${$self->{entriesstat}}[$_]) {
push @list,$_;
}
}
@list;
}
########################################################
=head1 CLASS Tui::Dropbox
This widget is sometimes also known als a combobox. When it
recieved the focus, a listbox will dropdown where the user can make
a choice. The only restriction is that the dropbox MUST fit into the
Form where it is used when used within a form.
Inherits from L<CLASS Tui::Widget>.
=cut
package Tui::Dropbox;
use Curses;
@ISA = (Tui::Widget);
=head2 Tui::Dropbox::new
Contructor for the dropbox widget
=over 2
=item Input Paramters
1 x coordinate of the left top
2 y coordinate of the left top
3 width of the widget
4 heigth of the dropbox (defaults to 6)
=item Ouput Parameters
1 reference to the object
=back
=cut
sub new {
my ($class) = shift;
my ($self) = {};
bless $self,$class;
$self->{x1} = shift;
$self->{y1} = shift;
$self->{width} = shift;
$self->{rows} = shift || 6;
$self->{entries} = [];
$self->{pos} = 0;
$self->{start} = 0;
$self->{win} = stdscr;
$self->{color} = 0;
$self->{style} = 0;
$self->{vscrollbar} = 0;
$self->{hscrollbar} = 0;
$self->{drawvscrollbar} = 1;
$self->{drawhscrollbar} = 1;
$self->{showscrollbar} = 1;
$self->{maxwidth} = 0;
$self->{xpos} = 0;
$self->{current} = 0;
$self->{subwin} = stdscr;
$self->{wraparound} = 0;
( run in 1.549 second using v1.01-cache-2.11-cpan-2398b32b56e )