Hi, this seems to do what you want. Notice the $pane is packed after the ROText is added to it. Just for your info, the Scrolled Pane is an excellent widget, as it handles the scrollbars very well.
#!/usr/bin/perl use strict; use warnings; use Cwd; use Tk qw( MainLoop ); require Tk::ROText; { my $startb; my $textbox; my $mw = MainWindow->new(-background => 'gray50' ); my $listbox = $mw->Scrolled('Listbox', -font => "{Courier New} 12 bold", -background => 'DarkCyan', -foreground => 'OldLace', -scrollbars => 'se', -selectmode => "single", )->pack(-expand => 0, -fill => 'x'); my $pane=$mw->Scrolled('Pane',-scrollbars => 'se'); $textbox = $pane->ROText(-font => "{Courier New} 12 bold", -background => 'DarkBlue', -foreground => 'OldLace', -wrap => 'none', -height =>8 )->pack(-expand => 0, -fill => 'x', -anchor => 'n'); $pane->pack(-expand => 1, -fill => 'x'); my $buttonFrame = $mw->Frame()->pack(-side => 'bottom', -fill=>'both', + -expand=>0); # Button to increase the height of the text box my $growb = $buttonFrame->Button( -text => '+', -command => sub { $textbox->packForget; $textbox->configure(-height => 11); $textbox->pack(-expand => 0, -fill => 'x', -anchor => 'n'); $textbox->configure(-background => 'red1'); $mw->idletasks; $mw->packPropagate(0); }, )->pack(-side => "left", -fill => "both", -expand => 0); # Button to decrease height of text box my $shrinkb = $buttonFrame->Button( -text => '-', -command => sub { $textbox->packForget; $textbox->configure(-height => 6); $textbox->pack(-expand => 0, -fill => 'x', -anchor => 'n'); $textbox->configure(-background => 'DarkBlue'); $mw->idletasks; }, )->pack(-side => "left", -fill => "both", -expand => 0); MainLoop(); }
In reply to Re: Question about how to implement user control over text box height
by zentara
in thread Question about how to implement user control over text box height
by CrashBlossom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |