use strict; use warnings; use Tk; use Tk::TableMatrix::Spreadsheet; my $mw = Tk::MainWindow->new; $mw->geometry('400x300'); # loaded from setup if given, defaults to 1000x600 my %arrayVar; my $arrayVar = \%arrayVar; # Ref to hash my $t = $mw->Spreadsheet( -rows => 1, -cols => 2, -width => 16, -variable => $arrayVar, )->pack(-expand => 1, -fill => 'both');; $t->rowHeight(0, 6); $arrayVar->{"0,1"} = "some text directly inserted into the cell"; my $tw = $mw->Text( -wrap => "word"); $tw->insert("1.0", "here is some text in a Text widget; some more text some more text some moooore text and then some more text"); $tw->tagConfigure('highlight', -background => "yellow"); $tw->tagAdd('highlight', '1.23', '1.27'); # can also use 'end' and 'lineend' $tw->pack(); # loose text widget for testing # $t->windowConfigure("0,0", -window => $tw); # -sticky => 's', #put the Text widget in the tablematrix table my $cgetheight = $tw->cget(-height); print "height based on cget $cgetheight"; my ($x,$y,$w,$h,$b)=$tw->dlineinfo('1.0'); print "\nHeight based on dlineinfo: $h"; my $widgetheight = $tw->height; print "\nWidget height: $widgetheight\n"; my ( $width, $height, $deltax, $deltay ) = split /[+x]/, $tw->geometry; print "Height based on geometry: $height\n"; ($x,$y,$w,$h)=$tw->bbox('1.0'); print "X: $x\n"; print "Y: $y\n"; print "W: $w\n"; print "Height based on bbox: $h\n"; MainLoop;