atreyu has asked for the wisdom of the Perl Monks concerning the following question:
I'm using Tk::Table and I'm having a problem with the scrollbars. I want to have a scrollbar appear only on the right-hand side, and only if there is a 'real' need to scroll (as the Tk::Scrolled pod puts it). This would mean using the 'oe' anchor for the -scrollbars option. This I have done (see code), but I still get the scrollbar, even when it is not needed. Does anyone know why? If there are alternative solutions, keep in mind that I need/want that top non-scrolling row of column headers to still work as designed.
here's the code:
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Table; my $cols = 6; my $rows = 10; # create the main window and frame my $mw = new MainWindow(); my $frame = $mw->Frame()->pack; my $table = $frame->Table( -columns => $cols, -rows => $rows + 1, -fixedrows => 1, -scrollbars => 'oe', -relief => 'raised', ); # column headings for my $c(1 .. $cols){ my $tmp = $table->Label(-text => 'Row '.$c, -width => 6, -relief => 'raised', ); $table->put(0,$c,$tmp); } # populate the cells and bind an action to each one for my $r(1 .. $rows){ for my $c(1 .. $cols){ my $tmp = $table->Label( -text => $r.','.$c, -padx => 2, -anchor => 'w', -background => 'white', -relief => 'groove', ); $table->put($r,$c,$tmp); } } $table->pack(-expand => 'yes',-fill => 'both'); MainLoop();
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk::Table and optional scrollbar
by Khen1950fx (Canon) on Jul 26, 2012 at 21:35 UTC | |
by Anonymous Monk on Jul 26, 2012 at 22:28 UTC | |
|
Re: Tk::Table and optional scrollbar
by zentara (Cardinal) on Jul 27, 2012 at 13:08 UTC | |
by Anonymous Monk on Jul 28, 2012 at 08:14 UTC | |
by zentara (Cardinal) on Jul 28, 2012 at 10:27 UTC | |
by atreyu (Sexton) on Jul 27, 2012 at 15:55 UTC | |
by Anonymous Monk on Jul 28, 2012 at 08:15 UTC | |
|
Re: Tk::Table and optional scrollbar
by Anonymous Monk on Jul 26, 2012 at 22:53 UTC |