Leser: 20
1 2 3 4 5 6 7
$hlist->ItemStyle( 'text' => -stylename => 'green', -foreground => 'green', ); $hlist->itemCreate( $nr, 0, -text => 'X', -style => 'green' );
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
use strict; use warnings; use Tk; use Tk::HList; use Tk::ItemStyle; use Tk::HdrResizeButton; my $mw = MainWindow->new(); my $table_hl = $mw->Scrolled( "HList", -header => 1, -columns => 2, -scrollbars => 'ose', -width => 70, -selectbackground => '#539FFD', -selectmode => 'extended', )->pack(); $table_hl->header('create', 0, -text => "1"); $table_hl->header('create', 1, -text => "2"); $table_hl->add(1); $table_hl->itemCreate(1, 0, -text => "Schriftart 123"); $table_hl->itemCreate(1, 1, -text => "Scrhiftart 123"); my $style = $table_hl->ItemStyle( 'text', -stylename => 'red', -foreground => 'red', -selectforeground => 'red', ); $table_hl->add(2); $table_hl->itemCreate(2, 0, -text => "Schriftart 123", -style => 'red'); $table_hl->itemCreate(2, 1, -text => "Scrhiftart 123", -style => $style); MainLoop;
2011-01-06T14:10:35 MatthiasWAnsonsten kannst du es mal mit my $font = $hlist->cget('-font'); versuchen. Allerdings weiß ich nicht, ob hier tatsächlich die Standardschrift zurückgeliefert wird.
MfG