in reply to Re: Array to scroll..
in thread Array to scroll..

The scroll is actually an scrolled entry box. I would like to get the values out of the scrolled entrybox by like it is possible to get the value out of a normal entry box with the method "get". Is there any equivalent method that could be used to get the values out from the entry box?

Replies are listed 'Best First'.
Re^3: Array to scroll..
by zentara (Cardinal) on Jul 27, 2006 at 16:04 UTC
    I've never heard of a scrolled entry box, but maybe this is what you are looking for with a scrolled Listbox. It seems that you should read a book on Tk, these questions are very simple.
    #!/usr/bin/perl use warnings; use strict; use Tk; # Main Window my $mw = MainWindow->new; # Frames my $tf_frame = $mw->Frame->pack(); my $f_frame = $mw->Frame->pack(); my $bf_frame = $mw->Frame->pack(); # File Listing Label $tf_frame->Label(-text => "Select Items") ->pack(-side => 'left'); my @items = (1..500); my $listbox = $f_frame->Scrolled("Listbox", -scrollbars => "oe", -selectmode => "extended")->pack; $listbox->insert('end', @items); $bf_frame->Button(-text => "Done", -command => sub { &print_names($listbox); exit; })->pack; MainLoop; sub print_names{ my $listbox = shift; my @selected_items = $listbox->curselection; for (@selected_items) { my $item = $listbox->get($_); print "$item\n"; } }

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum