wcpyro has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use Tk; my $mw = MainWindow->new; our $viewbox = $mw->Listbox(-height=>'30',-width=>'70')->pack(-expand= +>'1',-fill=>'both'); load($viewbox); MainLoop; sub load { my $idnum; my $tags; ($idnum,$tags) = (123,'tag1 tag2'); $viewbox->insert('end', "$idnum\t$tags"); }
SECOND UPDATE: $viewbox->delete('active') Deletes the currently selected entry. How I missed this, I have no idea..my $entry = $viewbox->curselection; print $viewbox->get($entry)."\n";
This enables you to read the entire listbox and print it out line by line.my @contents = $viewbox->get('0','end'); foreach (@contents) {print "$_\n";}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using a Listbox (Tk)
by halfcountplus (Hermit) on Mar 27, 2008 at 22:41 UTC | |
by wcpyro (Novice) on Mar 28, 2008 at 00:00 UTC | |
|
Re: *RESOLVED* Using a Listbox (Tk)
by zentara (Cardinal) on Mar 28, 2008 at 16:27 UTC |