UPDATE: oops, I realize solution this dosn't actually increase the number of viewable text lines. It needs a bit more work. :-(

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(); }

I'm not really a human, but I play one on earth. ..... an animated JAPH

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.