Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 96a9fad5758a2558b4a55b474dc313af > files > 36

perl-Tk-TableMatrix-1.230.0-23.mga7.armv7hl.rpm

# Script show tag merging behavior with an option set in the 
#  option database. 
#
#   Should display with one row hightlighted red and a cell in the row left-justified

use Tk;
use Tk::TableMatrix;

use strict;

my $mw = MainWindow->new;

#$mw->optionAdd('*background', 'blue', 'interactive');
$mw->optionAdd('*tablematrix*background', 'skyblue');

my $table = $mw->TableMatrix(-rows => 5,
                            -cols => 8,
                            -cache => 1,
			    #-bg => 'blue',
			    );                
$table->pack(-expand => 1, -fill => 'both');


foreach my $row (0..4) {
     #$table->tagRow('invalid', $row);                # swap
     foreach my $column (0..7) {
       $table->set("$row,$column", "hello");
             #$table->tagCell('left', "$row,$column");    # swap
   }
}

# 'invalid' tag takes priority of 'left' tag, because it is created first, 
#     so the cell 2,3 should be red and center anchored, but see below...
$table->tagConfigure("invalid", -background => 'red', -anchor => 'center');
$table->tagConfigure("left",    -background => 'green', -anchor => 'w');


$table->tagCell('left', '2,3');
$table->tagRow('invalid', 2);

#  The tag priority is changed, so the cell 2,3 will be gree and 'w' achored.
$table->tagRaise('left', 'invalid');

# This would have the same effect as the above tagRaise
#$table->tagLower('invalid', 'left');

MainLoop;