in reply to Re: scrolling MListbox in Perl/tk
in thread scrolling MListbox in Perl/tk
It's basically the code I am using except I stripped out the database stuff and just went with a random number generator. I pulled the font stuff out because it was throwing an error and I didn't feel like debugging it.use warnings; use strict; use Tk; use Tk::Pane; use Tk::NoteBook; use DBI; use Tk::MListbox; ### Build Main Window # my $mainWindow = MainWindow->new; $mainWindow->geometry("800x600"); my $frame = $mainWindow->Frame(-bd => 2, -relief => 'raised')->pack(- +expand => 1, -fill => 'both'); my $scrolledMListbox = $frame->Scrolled( qw/ MListbox -selectmode browse -scrollbars oe / )->pack(-expand => 1, -fill => 'both'); $scrolledMListbox->columnInsert('end', -text=>'Date', -sortable=>1, +-width => 10); $scrolledMListbox->columnInsert('end', -text=>'Time', -sortable=>1, +-width => 10); $scrolledMListbox->columnInsert('end', -text=>'Property', -sortable= +>1, -width => 10); $scrolledMListbox->columnInsert('end', -text=>'Name', -sortable=>1, +-width => 10); $scrolledMListbox->columnInsert('end', -text=>'Address', -sortable=> +1, -width => 10); $scrolledMListbox->columnInsert('end', -text=>'Phone', -sortable=>1, + -width => 10); $scrolledMListbox->bindRows('<ButtonRelease-1>', sub { my ($w, $infoHR) = @_; print "@_\n"; print "You selected row: " . $infoHR->{-row} . " in column: " . $infoHR->{-column} . "\n"; print $scrolledMListbox->getRow( $scrolledMListbox->curselection +()->[0] ),"\n"; } ); for (my $count = 100; $count >= 1; $count--){ $scrolledMListbox->insert('end', [[int rand 20], [int rand 20], [ +int rand 20], [int rand 20], [int rand 20], [int rand 20]]); } MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: scrolling MListbox in Perl/tk
by zentara (Cardinal) on Jul 16, 2008 at 20:00 UTC | |
by vortmax (Acolyte) on Jul 16, 2008 at 20:12 UTC | |
by Anonymous Monk on Sep 02, 2008 at 22:08 UTC | |
by zentara (Cardinal) on Sep 03, 2008 at 12:54 UTC | |
by Anonymous Monk on Sep 03, 2008 at 15:33 UTC | |
by runrig (Abbot) on Jul 17, 2009 at 20:15 UTC | |
by Llew_Llaw_Gyffes (Scribe) on Dec 29, 2009 at 20:37 UTC |