Hi All ,
Pls see below a price of code that uses table matrix widget. What I
have done is that I have increased the width of the last column. Now,
if you try to move the horizontal scrollbar, it move move only to a
certain distance and will not move after that and hence, the data in
the last column of the spreadsheet cannot be viewed.
Pls suggest what the issue could be & the possible solution.
=====================================================
use Tk;
use TableMatrix;
use Tk::Balloon;
my $mw;
$mw = MainWindow->new();
$mw->geometry("500x400+0+0");
$mw->title("Main Window");
my $sheet = $mw->Scrolled('TableMatrix',
-rows => 10,
-cols => 5,
-width => 6,#this is req . See documentation of this
parameter.
-height => 0,
-rowseparator => "\n",
-titlerows => 1,-titlecols => 1,
-resizeborders => 'both',-scrollbars => 'osoe',
-wrap => 0,
-exportselection => 0,
-colstretchmode => 'last',
-rowstretchmode => 'none',
-selectmode => 'single',
-validate => 1, -sparsearray => 0 ,-selecttype => 'cell',
-anchor =>'w',-flashmode => 'off',-drawmode => "slow"
)->pack( -fill =>'both', -pady => 0, -expand=>1);
$sheet->colWidth(4 => 280);
my $spreadSheetVar = $sheet->cget( -variable );
for (my $i = 1; $i < 10 ; $i++)
{
for (my $j = 1; $j < 5 ; $j++)
{
if($j == 4)
{
$spreadSheetVar->{ "$i,$j" } =
"CheckingAAABBBCCCDDDEEEFFFGGGHHHCheckingAAABBBCCCDDDEEEFFFGGGHHHCheckingAAABBBCCCDDDEEEFFFGGGHHHCheckingAAABBBCCCDDDEEEFFFGGGHHHCheckingAAABBBCCCDDDEEEFFFGGGHHHCheckingAAABBBCCCDDDEEEFFFGGGHHHCheckingAAABBBCCCDDDEEEFFFGGGHHHCheckingAAABBBCCCDDDEEEFFFGGGHHHCheckingAAABBBCCCDDDEEEFFFGGGHHH
\n";
}
else
{
$spreadSheetVar->{ "$i,$j" } = "A\n";
}
}
}
$sheet->configure( -rows=> 10 );
$sheet->configure( -variable => $spreadSheetVar);
$mw->deiconify();
$mw->raise();
MainLoop;
=====================================================
zentara - 30 Jun 2008 15:22 GMT
>Hi All ,
>Pls see below a price of code that uses table matrix widget. What I
[quoted text clipped - 3 lines]
>the last column of the spreadsheet cannot be viewed.
>Pls suggest what the issue could be & the possible solution.
Your code ran ugly for me, but here is a basic example of how to add
a column from a previous example posted here.
Also, another general solution to scrollbar update problems, is to use a
Scrolled Pane and put a non-scrolled widget into it. It will generally
behave better.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $mw = tkinit;
$mw->geometry('100x100');
my $t= $mw->Scrolled('TableMatrix',
-cols => 4,
)->pack(-fill =>'both',
-expand => 1,
);
my $tm = $t->Subwidget('scrolled');
$mw->Button(-text=> 'add column',
-command=>sub{$t->packPropagate(1);
$t->insertCols(0,1);
$mw->update;
print 'table matrix requires width:',
$tm->reqwidth,"\n";
print 'scrolled requires width:',
$t->reqwidth,"\n";
print 'MainWindow requires width:',
$mw->reqwidth,"\n";
$mw->maxsize($mw->reqwidth,$mw->reqheight);
},
)->pack;
MainLoop;
__END__
zentara

Signature
I'm not really a human, but I play one on earth.
http://zentara.net/CandyGram_for_Mongo.html