bind double click to resize text widget(s)

[email protected]
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
I used the Mastering Perl Tk example to get a basis for what I'm trying 
to do.  The text widgets are adjustable in the sense that you can make 
one smaller and the other larger by moving the adjustment bar. I'd like 
to bind the mouse Double Click to resize the text widget that was 
clicked larger and the other text widget a bit smaller.  Basically 
giving more focus to a particular text widget.  I'm not able to get the 
bind to work as of yet and I am not counting on my resize code to work.


use Tk;
use Tk::Adjuster;

$mw = MainWindow->new(-title => "Adjuster example");

my $frame1=$mw->Frame();
$frame1->pack();

$topw = $frame1->pack(-side => 'top', -fill => 'x');
$botw = $frame1->pack(-side => 'bottom', -fill => 'both', -expand => 1);

$topw->bind('<Double-Button-1>', \&resize(0));
$botw->bind('<Double-Button-1>', \&resize(1));

$lb = $topw->Scrolled('Text', -scrollbars => 'osoe', -height => 10)
  ->packAdjust(-expand => 1, -fill => 'both');

$botw->Scrolled('Text', -scrollbars => 'osoe', -height => 10)
  ->pack(-expand => 1, -fill => 'both');

MainLoop();

sub resize () {
        my $parm = shift;
        
        #if value is 1 (true) then botw was clicked, else topw
        if ($parm) {
                $topw->configure(-height=> 5);
                $botw->configure(-height=> 10);
        } else {
                $topw->configure(-height=> 10);
                $botw->configure(-height=> 5);
        }
}
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.