in reply to Re: scrolling MListbox in Perl/tk
in thread scrolling MListbox in Perl/tk

that example didn't work for me either. Sorry about not posting working code. Here is some simplified code that is based off your example, but still gives the exact behavior I described. The table loads fine, but the scroll bar doesn't work and when you sort by a column it empties the table.
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;
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.

Replies are listed 'Best First'.
Re^3: scrolling MListbox in Perl/tk
by zentara (Cardinal) on Jul 16, 2008 at 20:00 UTC
    You probably don't want to hear this, but your code works fine for me on linux, with Tk-804.027 The column sorting works just fine. Maybe you need to upgrade?

    I'm not really a human, but I play one on earth CandyGram for Mongo
      that was it...

      I checked my versions of perl and Tk and both were brand spankin new, but but apparently my version of MListbox was old. I'm trying to remember where I got it now, as the one I manually downloaded from CPAN and installed is working.
      I'm seeing similar errors on Solaris 5.10 i86, with Perl 5.8.8, Tk-804.027 and MListbox 1.11. According to CPAN 1.11 is the latest version. Any known limitation for Solaris x86?
      Thanks
      Patricia