Hi Monks,
Please have a look in the code below.
I'm trying to have a scrollable table with fixed headers.Each cell of the table is a canvas, whose size may vary. This is a reduced version, containing only fixed size canvases with no items on them.
I expect that if the canvases are too high, the scrollbar on the right side will be activated. But if I enlarge the height of the canvases (change $graph_height to 800), they disappear...
Please advise!
#!/usr/bin/perl -w
use strict;
use warnings;
use Tk;
use Tk::Table;
my $graph_width=300;
my $graph_height=700;
#my $graph_height=800;
my $title_c;
my $group;
my $canvas;
my $table;
my @group_names=('A','B');
my $col=0;
my $graph_win = MainWindow->new( );
$graph_win->withdraw;
$table= $graph_win->Table(
-rows => 2,
-columns => 2,
-scrollbars => 'e',
-fixedrows => 1,
-fixedcolumns => 0
)->pack(
-expand => 1,
-fill => 'both',
);
foreach $group (@group_names){
$title_c=$table->Label(
-text => $group,
-relief => 'groove',
-font => "{Arial} 15 bold",
-borderwidth => 2,
);
$table->put(0,$col, $title_c);
$col++;
}
$col=0;
foreach $group (@group_names){
$canvas = $table->Scrolled("Canvas",
-scrollbars => 's',
-width => 300,
-height => $graph_height,
-background => 'white',
-borderwidth => 2,
-relief => 'groove',
-scrollregion => [0,0,$graph_width,$graph_height]
);
$table->put(1,$col++, $canvas);
}
$graph_win->deiconify();
$graph_win->raise();
$graph_win->geometry('1000x800+10+10');
MainLoop;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.