Skip Menu |

This queue is for tickets about the Tk-Wizard-Bases CPAN distribution.

Report information
The Basics
Id: 11322
Status: resolved
Priority: 0/
Queue: Tk-Wizard-Bases

People
Owner: Nobody in particular
Requestors: MTHURN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.06
Fixed in: (no value)



Subject: PATCH for size of tag_text
Attached is a patch that cleans up the sizing of the tagtext Canvas. I made it depend on the font size and the length of the actual text. Unless the text contains lots of skinny letters (or lots of wide characters), the user doesn't even need to pass in -tag_width.
diff -c /PROJECTS/perlmod/Tk-Wizard-Bases-1.06/Wizard.pm.2.fonts /PROJECTS/perlmod/Tk-Wizard-Bases-1.06/Wizard.pm *** /PROJECTS/perlmod/Tk-Wizard-Bases-1.06/Wizard.pm.2.fonts Tue Feb 1 14:36:04 2005 --- /PROJECTS/perlmod/Tk-Wizard-Bases-1.06/Wizard.pm Tue Feb 1 15:03:10 2005 *************** *** 212,218 **** =item Switch: -tag_width Width for C<-tag_text>, above: when I work out better C<pack>ing, ! this will no longer be needed. Default value is 75 pixels. =item Switch: -tag_disable --- 212,219 ---- =item Switch: -tag_width Width for C<-tag_text>, above: when I work out better C<pack>ing, ! this will no longer be needed. ! Default value is based on the length of your -tag_text. =item Switch: -tag_disable *************** *** 227,232 **** --- 228,235 ---- sub Populate { my ($cw, $args) = @_; my $sFontFamily = &_font_family(); my $iFontSize = &_font_size(); + my $sTagTextDefault = 'Perl Wizard'; + my $iTagWidthDefault = $iFontSize * length($sTagTextDefault) / 1.5; $cw->SUPER::Populate($args); $cw->ConfigSpecs( # ? -title => ['SELF','title','Title','Generic Wizard'], *************** *** 250,257 **** -finishButtonAction => ['PASSIVE',undef,undef,undef], -preCancelButtonAction => ['CALLBACK',undef, undef, sub { &DIALOGUE_really_quit($cw) }], -preCloseWindowAction => ['CALLBACK',undef, undef, sub { &DIALOGUE_really_quit($cw) }], ! -tag_text => ['PASSIVE',"tag_text","TagText","Perl Wizard"], ! -tag_width => ['PASSIVE',"tag_width","TagWidth",75], ); if (not exists $args->{-imagepath} or !-e $args->{-imagepath}){ --- 253,260 ---- -finishButtonAction => ['PASSIVE',undef,undef,undef], -preCancelButtonAction => ['CALLBACK',undef, undef, sub { &DIALOGUE_really_quit($cw) }], -preCloseWindowAction => ['CALLBACK',undef, undef, sub { &DIALOGUE_really_quit($cw) }], ! -tag_text => ['PASSIVE', "tag_text", "TagText", $sTagTextDefault], ! -tag_width => ['PASSIVE', "tag_width", "TagWidth", $iTagWidthDefault], ); if (not exists $args->{-imagepath} or !-e $args->{-imagepath}){ *************** *** 303,318 **** )->pack( -side => 'left', -anchor => 'w',-pady=>10,-padx=>10); } $buttonPanel->pack(qw/ -side bottom -fill x/); # Container for line/tag my $tagbox = $cw->Frame( ! -width => $cw->cget(-width)-($args->{-tag_width}||75)||450, # -background=>$cw->cget(-background), -height => 12, )->pack(qw/-side bottom -fill x/); - # Tag text - $args->{-tag_text} = "Perl Wizard" unless exists $args->{-tag_text}; - $args->{-tag_width} = 80 unless exists $args->{-tag_width}; $cw->fontCreate('TAG', -family => $sFontFamily, -size => $iFontSize, --- 306,323 ---- )->pack( -side => 'left', -anchor => 'w',-pady=>10,-padx=>10); } $buttonPanel->pack(qw/ -side bottom -fill x/); + + # Tag text + $args->{-tag_text} = $sTagTextDefault unless exists $args->{-tag_text}; + $iTagWidthDefault = $iFontSize * length($args->{-tag_text}) / 1.5; + $args->{-tag_width} = $iTagWidthDefault unless exists $args->{-tag_width}; # Container for line/tag my $tagbox = $cw->Frame( ! -width => $cw->cget(-width)-($args->{-tag_width}||$iTagWidthDefault)||450, # -background=>$cw->cget(-background), -height => 12, )->pack(qw/-side bottom -fill x/); $cw->fontCreate('TAG', -family => $sFontFamily, -size => $iFontSize, *************** *** 319,332 **** -weight => 'bold', ); $cw->{tagtext} = $tagbox->Canvas( ! -relief => 'flat', ! -border => 1, ! -height => 12, ! -width => $args->{-tag_width}, )->pack(qw/-side left -anchor w/); ! $cw->{tagtext}->createText(2,7,-text=>$args->{-tag_text},-fill=>'#999999',-anchor=>'w',-font=>'TAG',); ! $cw->{tagtext}->createText(2,9,-text=>$args->{-tag_text},-fill=>'white',-anchor=>'w',-font=>'TAG',); ! $cw->{tagtext}->createText(2,8,-text=>$args->{-tag_text},-fill=>'gray',-anchor=>'w',-font=>'TAG',); # Line above buttons $cw->{tagline} = $tagbox->Frame( --- 324,337 ---- -weight => 'bold', ); $cw->{tagtext} = $tagbox->Canvas( ! -relief => 'flat', ! -border => 1, ! -height => $iFontSize * 1.5, ! -width => $args->{-tag_width}, )->pack(qw/-side left -anchor w/); ! $cw->{tagtext}->createText(4,7,-text=>$args->{-tag_text},-fill=>'#999999',-anchor=>'w',-font=>'TAG',); ! $cw->{tagtext}->createText(4,9,-text=>$args->{-tag_text},-fill=>'white',-anchor=>'w',-font=>'TAG',); ! $cw->{tagtext}->createText(4,8,-text=>$args->{-tag_text},-fill=>'gray',-anchor=>'w',-font=>'TAG',); # Line above buttons $cw->{tagline} = $tagbox->Frame(