Dear monks,
I am writing a GUI for a program. This GUI has two text boxes
($text and $text2) a vertical scrollbar that scrolls both
textboxes and two horizontal scrollbars that are meant to scroll
each textbox (separately) horizontally. I am not using scrolled,
so that I can get my vertical scrollbar moving both boxes.
The two textboxes and the vertical scrollbar and in $topframe
and the horizontals are in $middleframe, below the textboxes.
The problem is the horizontal bars are teeny-weeny not filling up the
x axis despite me using fill=>'x'
The vertical scroll is fine, any ideas on why my horizontals arent working ?
Here is the code:
####################################
# scrollbars
####################################
# Setup two individual horizontal scroll bars for the text windows
# Setup vertical scroll bar for both text windows
$yscroll= $topframe->Scrollbar()->pack(-fill => 'y', -side => 'right')
+;
sub scroll_both{
my ($sb,$wigs,@args) = @_;
my $w;
foreach $w (@$wigs)
{
$w->yview(@args);
}
}
# Create Right Text widget...
my $text = $topframe->Text(-wrap => 'none' )->
pack(-expand=> 1, -fill=> 'both', -side=> 'right');
# Create Left Text Widget...
my $text2 = $topframe->Text(-width=>'20', -wrap => 'none' )->
pack(-expand=> 1, -fill=> 'both');
$xscrollleft= $middleframe->Scrollbar(-orient=>'horizontal')->pack(-fi
+ll => 'x',-side=>'left',-expand=> 1,);
$xscrollright= $middleframe->Scrollbar(-orient=>'horizontal')->pack(-f
+ill => 'x',-side=>'right',-expand=> 1,);
# Connect scrollbars to text widgets...
$yscroll->configure( -command => [ \&scroll_both, $yscroll,
[$text,$text2]]);
$text->configure( -yscrollcommand => [ 'set', $yscroll]);
$text2->configure( -yscrollcommand => [ 'set', $yscroll]);
$text2->configure( -xscrollcommand => [ 'set', $xscrollright]);
$text->configure( -xscrollcommand => [ 'set', $xscrollleft]);
Thanks for your time
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.