| Newsgroups |
gmane.comp.lang.perl.tk |
| Message-ID |
<[email protected]> |
Sorry to beat this to death, but I do have a solution to resizing
widgets by using GeometryRequest. Right now a fundamental problem has
cropped up with the callback in the bind definition. For some reason
when I shift the parameters to the variable $parm, $parm becomes the
HASH for the actual Text widget and not the value 0 or 1 as I believe I
have defined it. Please run this scripts and double click one of the
text widgets and review the print output. I really dont know how this
is possible.
#Script
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)-
>pack(-expand => 1, -fill => 'both');
my $adj1 = $mw->Adjuster();
$adj1->packAfter($tw, -side => 'top');
my $bw = $botw->Scrolled('Text', -scrollbars => 'osoe', -height => 10)-
>pack(-expand => 1, -fill => 'both');
#here value of 0 or 1 is passed when doubleclicking the Text widget
$tw->bind('<Double-Button-1>', [ \&resize, 0 ]);
$bw->bind('<Double-Button-1>', [ \&resize, 1 ]);
MainLoop();
sub resize () {
my $parm=shift;
#after double-clicking either Text widget for some reason $parm
is a HASH pointing to the widget and not
#a value of 0 or 1 ???
print "PARM: $parm\n";
}
#
#Output is as follows (clicked both widgets)
#PARM: Tk::Text=HASH(0x315ddbc)
#PARM: Tk::Text=HASH(0x32c3964)
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
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]