Subject: | Various cell / text selection issues (ASPN version) |
Tk::TableMatrix 1.2 (and Tk::TableMatrix::Spreadsheet) in the ASPN version for Windows. Run on Win2000.
Perl 5.8.0
I used the following example script and did some evaluation:
Show quoted text
--- CUT start ---
## maxsize.tcl
##
## This demo uses a really big table. The big startup time is in
## filling the table's Tcl array var.
##
## jeff.hobbs@acm.org
## Converted to perl/tk by John Cerney 7/24/00
## Modified for testing purposes by D. Marxsen
use Tk;
use Tk::TableMatrix;
use Tk::TableMatrix::Spreadsheet;
my $top = MainWindow->new;
my $arrayVar = {};
print "Filling Array...\n";
my ($rows,$cols) = (40000, 10);
foreach my $row (0..($rows-1)){
foreach my $col (0..($cols-1)){
$arrayVar->{"$row,$col"} = "$row,$col";
}
}
print "Creating Table...\n";
## Test out the use of a callback to define tags on rows and columns
sub colSub{
my $col = shift;
return "OddCol" if( $col > 0 && $col%2) ;
}
my $label = $top->Label(-text => "TableMatrix v2 Example");
my $t = $top->Scrolled('Spreadsheet', -rows => $rows, -cols => $cols,
-width => 6, -height => 12,
-titlerows => 1, -titlecols => 1,
-variable => $arrayVar,
-coltagcommand => \&colSub,
-colstretchmode => 'last',
-flashmode => 1,
-flashtime => 2,
-wrap=>1,
-rowstretchmode => 'last',
-selectmode => 'extended',
-selecttype=>'cell',
-selecttitles => 0,
-drawmode => 'slow',
-scrollbars=>'se',
-sparsearray=>0
);
my $button = $top->Button( -text => "Exit", -command => sub{
$top->destroy});
# hideous Color definitions here:
$t->tagConfigure('OddCol', -bg => 'brown', -fg => 'pink');
$t->tagConfigure('title', -bg => 'red', -fg => 'blue', -relief => 'sunken');
$t->tagConfigure('dis', -state => 'disabled');
my $i = -1;
my $first = $t->cget(-colorigin);
my $anchor;
foreach $anchor( qw/ n s e w nw ne sw se c /){
$t->tagConfigure($anchor, -anchor => $anchor);
$t->tagRow($anchor, ++$i);
$t->set( "$i,$first",$anchor);
}
$top->fontCreate('courier', -family => 'courier', -size => 10);
$t->tagConfigure('s', -font => 'courier', -justify => 'center');
$t->colWidth( -2 => 8, -1 => 9, 0=> 12, 4=> 14);
$label->pack( -expand => 1, -fill => 'both');
$t->pack(-expand => 1, -fill => 'both');
$button->pack(-expand => 1, -fill => 'x');
Tk::MainLoop;
--- CUT end ---
OK, here are the problems I encountered:
1.
I expected Excel-like behaviour at cell selection:
a) Single click selects whole cell and typing replaces entire content.
b) Double click allows to set the cursor at a selectable location in the
existing text. Typing will insert text there.
What I got:
Method a) does work exactly one time. Then, single click moves the blue cell
highlight to the new location but the cursor remains in the old cell. You have to hit <Return> to be able to select full cells again.
BTW: The <Type-something><Return><Type-something><Return> works exactly as expected. To make it short: Clicking on another cell should finish the entry like <Return> does.
Method b) puts the cursor into the selected cell - but I have to use double-click to set the cursor at another location than the end of the existing text. A single-click would be more convenient (and identical to the Excel behaviour).
2.
I can't select a portion of the text in a cell.
Maybe, these problems are present in the ASPN-version only.
I hope that you address some of the above problems at the next release. I am eager to replace my simple table solution with your comfortable one ...
Cheers,
Detlef.