jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:
In the following Perl/Tk code I want the second column to be the same width as the resizable button above it. Any suggestions?
#!/usr/bin/perl -w use strict; use Tk; use Tk::HListplus; my $mw = MainWindow->new(); # CREATE HEADER STYLE 1 my $headerstyle1 = $mw->ItemStyle( 'window', -anchor => 'nw', -pady => -10, -padx => 10, ); # CREATE MY HLIST my $hlist = $mw->Scrolled( 'HListplus', -scrollbars => 'oe', -columns => 2, -header => 1, -width => 40, -headerstyle => $headerstyle1, )->pack( -side => 'left', -expand => 'yes', -fill => 'both' ); # CREATE HEADER STYLE 2 my $headerstyle = $hlist->ItemStyle( 'window', -anchor => 'nw', -pady => 0, -padx => 10, ); $hlist->header( 'create', 0, -itemtype => 'resizebutton', -style => $headerstyle, -text => 'Test Name', -activebackground => 'white', ); $hlist->header( 'create', 1, -itemtype => 'resizebutton', -style => $headerstyle, -text => 'Status', -activebackground => 'white', ); my $red = $hlist->ItemStyle( 'text', -foreground => '#800000', -backgr +ound => 'white' ); my $blue = $hlist->ItemStyle( 'text', -foreground => '#000080', -ancho +r => 'e', -background => 'white' ); foreach ( [ Joe => '$10,000' ], [ Peter => '$20,000' ], [ Raj => '$90, +000 something to make it very much wider' ], [ Zinh => '$0' ] ) { my $e = $hlist->addchild(""); $hlist->itemCreate( $e, 0, -itemtype => 'text', -text => $_->[0], -s +tyle => $red ); $hlist->itemCreate( $e, 1, -itemtype => 'text', -text => $_->[1], -s +tyle => $blue ); } Tk::MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Binding columns in Tk::Hlist
by rcseege (Pilgrim) on Oct 05, 2006 at 02:26 UTC | |
|
Re: Binding columns in Tk::Hlist
by Khen1950fx (Canon) on Oct 05, 2006 at 06:53 UTC | |
by rcseege (Pilgrim) on Oct 05, 2006 at 17:03 UTC |