Re: bind double click to resize text widget(s)

[email protected]
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Thanks for the response that easily fixed the bind problem.   Still not 
able to make size changes through widget calls for some reason, I guess 
it is something to do with pack.

use strict;
use warnings;
use Tk;
use Tk::Adjuster;

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

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

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

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

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

$tw->bind('<Double-Button-1>', [ \&resize, 0 ]);
$bw->bind('<Double-Button-1>', [ \&resize, 1 ]);

MainLoop();

sub resize () {
        my $parm = shift;
        
        if ($parm) {
                #basically trying to "redraw" at this point.....
                $tw->packForget;
                $bw->packForget;
                $tw->configure(-height=>5);
                $bw->configure(-height=>15);
                $tw->pack;
                $bw->pack;
        } else {
                $tw->packForget;
                $bw->packForget;
                $tw->configure(-height=>15);
                $bw->configure(-height=>5);
                $tw->pack;
                $bw->pack;
        }
}








----- Original Message -----
From: Ala Qumsieh <[email protected]>
Date: Wednesday, September 21, 2005 3:08 pm
Subject: Re: bind double click to resize text widget(s)

> 
> 
> --- [email protected] wrote:
> 
> > $topw->bind('<Double-Button-1>', \&resize(0));
> > $botw->bind('<Double-Button-1>', \&resize(1));
> 
>  $topw->bind('<Double-Button-1>', [\&resize, 0]);
>  $botw->bind('<Double-Button-1>', [\&resize, 1]);
> 
> Check out 'perldoc Tk::callbacks' for more info.
> 
> --Ala
> 
> 
> 
>        	
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com
> 
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
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.