File: tagMerge2

package info (click to toggle)
libtk-tablematrix-perl 1.22-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,624 kB
  • ctags: 1,274
  • sloc: ansic: 15,026; perl: 3,376; makefile: 156; sh: 16
file content (49 lines) | stat: -rw-r--r-- 1,409 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl

# 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;