Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I've attempted to modify the demo code supplied with SpreadsheetHideRows to expand row 3 to display data across three rows. The data gets displayed but doesn't force the proceeding rows down by three. It seems to lay on top of them. Any idea why this happens or is this a bug with the module?

use Tk; use Tk::TableMatrix::SpreadsheetHideRows; my $top = MainWindow->new; my $arrayVar = {}; my @rawdata = (qw/ Quarter Month Region State AvgTemp 1 -- South -- 39 2 -- South -- 61 3 -- South -- 65 4 -- South -- 45 /); foreach my $row (0..4){ foreach my $col (0..5){ next if( $col == 0); $arrayVar->{"$row,$col"} = shift @rawdata; } } my $expandData = { 1 => { data => [ [ '','','Jan', 'South','--',33], [ '','','Feb', 'South','--',38], [ '','','Mar', 'South','--',45], ], tag => 'detail', expandData => { 1 => { data => [ [ '','','', '','Texas',35], [ '','','', '','Ok',36], [ '','','', '','Ark',37], ], tag => 'detail2', }, 2 => { data => [ [ '','','', '','Texas',41], [ '','','', '','Ok',42], [ '','','', '','Ark',43], ], tag => 'detail2', }, 3 => { data => [ [ '','','', '','Texas',51], [ '','','', '','Ok',52], [ '','','', '','Ark',53], ], tag => 'detail2', }, }, }, 2 => { data => [ [ '','','Apr', 'South','--',55], [ '','','May', 'South','--',61], [ '','','Jun', 'South','--',68], ], tag => 'detail', expandData => { 2 => { data => [ [ '','','', '','Texas',58], [ '','','', '','Ok',65], [ '','','', '','Ark',60], ], tag => 'detail2', } } }, 3 => { data => [['',"Testing \nMultiple \nRows"]], tag => 'detail', spans => [ 1 => '2,3'] }, 4 => { data => [['','Sorry, Detail Data Not Available Until Next +month']], tag => 'detail', spans => [ 1 => '0,3'] }, }; my $t = $top->Scrolled('SpreadsheetHideRows', -rows => 5, -cols => 6, -width => 6, -height => 6, -titlerows => 1, -titlecols => 1, -variable => $arrayVar, -selectmode => 'extended', -resizeborders => 'both', -selectorCol => 0, -expandData => $expandData # -state => 'disabled' # -colseparator => "\t", # -rowseparator => "\n" ); # Tags for the detail data: $t->tagConfigure('detail', -bg => 'palegreen', -relief => 'sunken'); $t->tagConfigure('detail2', -bg => 'lightskyblue1', -relief => 'sunken +'); $t->pack(-expand => 1, -fill => 'both'); Tk::MainLoop;

Thanks!

Replies are listed 'Best First'.
Re: SpreadSheetHideRows with multiple rows ?
by ldln (Pilgrim) on Aug 31, 2005 at 14:30 UTC
    When expanding rows/columns in TableMatrix the underlying cells (that some cells have expanded over) still exists, although not visible. The span just overlaps nearby existing cells to resize other cell(s). This is the reason why "nothing moves down". This makes it bit of a mess to use, since we have to keep track of what cells that: a) exist but are not visible, b) spanned and visible and c) normal (unspanned and visible)..

    Also the TableMatrix docs says: "When setting a span, checks are made as to whether the span would overlap an already spanning or hidden cell. This is an error and it not allowed".

    This is something we have to consider when trying to do vertical spanning of cells, cos we have to make sure that span does not overlap non-expanded SpreadsheetHideRows rows.

      Is there no way to "fool" the module by adding empty array indicies or by inserting rows in order to get around this?