in reply to Tk::Table and optional scrollbar

I would try putting $table into a Scrolled Pane, rather than a Frame. Frames don't deal with Scrolling well, but Panes do.
#!/usr/bin/perl use strict; use Tk; use Tk::Pane; my $mw = MainWindow->new; $mw->geometry( '400x250' ); my $mwf = $mw->Scrolled( 'Pane', -scrollbars => 'ose', -sticky => 'nwse', )->pack( -expand => 1, -fill => 'both' ); my $f1 = $mwf->Frame()->pack( -expand => 1, -fill => 'both' ); my $f2 = $mwf->Frame()->pack( -expand => 1, -fill => 'both' ); my %dudes; my $dude_count = 1; foreach my $fr($f1, $f2){ foreach (1..6){ $dudes{$dude_count}{'text'} = $fr->Text( -background => 'white', -foreground => 'black', -height => 10, -width => 22 )->pack(-side=>'left', -expand => 1, -fill => 'both' ); $dudes{$dude_count}{'text'}->insert('end', "\n Dude $dude_count\n") +; $dude_count++; } } MainLoop();

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Tk::Table and optional scrollbar
by atreyu (Sexton) on Jul 27, 2012 at 15:55 UTC
    that is tempting, zentara, but I lose that non-scrolling header row.
      my $header = $mw->Pane->pack( -side => 'top' ); my $rest = $mw->Scrolled ... ->pack;
Re^2: Tk::Table and optional scrollbar
by Anonymous Monk on Jul 28, 2012 at 08:14 UTC

    Frames don't deal with Scrolling well, but Panes do.

    Thats funny, because what Scrolled does, is create a Frame with scrollbars, and puts your widget (Pane) inside, and Tk::Table is-a Tk::Frame

      If you read "perldoc -m Tk::Pane" there is alot more being done that just creating a Frame with Scrollbars. All I can say is that Scrolled Panes respond better than Scrolled Frames.

      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh