1 2
my $red_style = $hlist -> ItemStyle('text', -background => "red"); $red_style->configure(-background => 'yellow');
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
my @values = qw /test testtest2 test3 testtest4 test5 testtest6 test7 testtest8/; my $blue_style = $hlist -> ItemStyle('text', -background => "lightblue"); my $red_style = $hlist -> ItemStyle('text', -background => "red"); #$red_style->configure(-background => 'yellow'); $hlist -> itemCreate($i, 0, -text => $values[$j], -style => ($i % 2) ? $blue_style : $red_style); my $j = 0; for (my $i=0; $i <= ($#values/2); $i++) { $hlist -> add($i); $hlist -> itemCreate($i, 0, -text => $values[$j], -style => ($i % 2) ? $blue_style : $red_style); $j++; $hlist -> itemCreate($i, 1, -text => $values[$j], -style => ($i % 2) ? $blue_style : $red_style); $j++; }