1#!/usr/bin/perl
2use strict;
3use Tk;
4use Tk::Table;
5
6use vars qw/ @Testat /;
7@Testat= (-3,-3,-3,-3,-3,-3);
8
9### ATTENTION  an array MUST be assigned something before it can be
10###            used as a '-variable' in a (Radio/Check/) Button
11###            NEVER use a list assign like  @Testat= (list)
12###            since this reallocates @Testat
13
14my $MW = new MainWindow;
15
16my $Table= $MW->Table(-columns => 7, -rows => 4, -fixedrows => 1,
17                                                -scrollbars => '')
18              ->pack(-pady=> '2c');
19
20# init Table
21
22$Table->Create(1,0,'Label',-text => '  Testat OK ->  ');
23$Table->Create(2,0,'Label',-text => '  No Testat ->  ');
24$Table->Create(3,0,'Label',-text => '  - UNDEF - ->  ');
25
26my $Mode;
27my $Alab;
28
29for (my $c= 1; $c <= 6; $c++)
30{ $Mode = ( $Testat[$c-1] >= 0 ? 'disabled' : 'normal' );
31  $Alab= ( $c < 6 ? "A$c" : "T" );
32  $Table->Create(0,$c,'Label',-text => $Alab );
33  $Table->Create(1,$c,'Radiobutton', -value => 1,  -state => $Mode,
34                                     -variable => \$Testat[$c-1] );
35  $Table->Create(2,$c,'Radiobutton', -value => 0,  -state => $Mode,
36                                     -variable => \$Testat[$c-1] );
37  $Table->Create(3,$c,'Radiobutton', -value => -3,  -state => $Mode,
38                                     -variable => \$Testat[$c-1] );
39}
40
41
42MainLoop;
43
44