in reply to Problems after upgrading both Perl and Tk
I managed to get consistent and (presumably close to) intended resizing results by changing this:
to this:$wjLabEntry->destroy; $mode_buttons->destroy; $wjLabEntry = $mw->Frame(-bg => "wheat1")->pack(); $mode_buttons = $mw->Frame(-bg => "wheat1")->pack();
That might not end up doing exactly what you want, but at least the window remains large enough to be usable and in fact gets bigger as needed. And at least it makes a certain amount of sense: Tk's pack manager will work better if the containing frames remain intact, as opposed to being destroyed and rebuilt from scratch.$_->destroy for ( $wjLabEntry->children ); $_->destroy for ( $mode_buttons->children );
Apart from that, if you pass those two frame widget handles as params to "do_setup" when calling it from get_job, you would be able to add "use strict" without any additional global variables, which would be a Good Thing.
And you can drop all the use Tk::*; lines -- just use Tk; will suffice. Ditto for all the $mw->update calls (those just aren't needed in this situation).
FINAL UPDATE: I'm guessing that the unpredictable behavior I was seeing with the OP code is probably related to the relatively recent Perl 5 feature that enhanced the security of hash key management -- this feature may have been missing in the ancient Solaris environment that the OP code came from, and in that old environment the code was probably always working because the Tk internal hashes were always being stored (and accessed/destroyed) in a consistent order. That consistency goes away in current Perl versions, which could mean that from one run to the next, calling "destroy" on the two frames that make up your entire MainWindow might cause variable results, depending on what gets destroyed first... But that's just a guess.
Anyway, I also noticed that since you don't seem to use the "$wjLabEntry" frame ever again, you can destroy that one, and just keep the "$mode_buttons" frame (destroying its children only). That would probably result in the appearance that you really want.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problems after upgrading both Perl and Tk
by monksp (Acolyte) on Jul 10, 2009 at 21:05 UTC |