rpelak has asked for the wisdom of the Perl Monks concerning the following question:

I have an app, that packforgets stuff and repacks it based on user input... Normally the frames and windows will resize automatically to fit whatever I pack and unpack... But if the users manually does a resize, then the auto resizer is off permanently... even if they take an action that causes more stuff to be packed in then fits...

Is there a way I can turn on the auto resizing again? I want the user to be able to resize since some of the info will be in scrolled listboxes, but I don't want to lose the auto if I repack something...

I have tried checking the packpropagate values, but they seem to stay unchanged.

Anyone know how to turn the autoresizer back on... I really just want to remove dead space, or expand for new things... any widget that got expanded by the users resize should stay expanded...

Thanks in advance

Randell
  • Comment on perltk autoresize following users resize

Replies are listed 'Best First'.
Re: perltk autoresize following users resize
by zentara (Cardinal) on Aug 19, 2008 at 12:24 UTC
      zentara's post was the most helpful. But I was hoping there was a way to just turn the auto resizer back on, not to have to force the window to a given size.
      Example...
      window is 100 tall. Containing a listbox. listbox is 25 tall. User wants so see more of the list box without scrolling, so they drag the window to 125. Widgets are setup so that the listbox expands to 50, and nothing else does. Then user checks a checkbox that causes the packing of an additional listbox in the gui. If the user hadn't manually resized the window, it would just expand to give space to the new listbox. But since they did, it will not change size, and the bottom of the form will run off the bottom of the window.
      of course since I know the size of the new listbox, I could increase the size of the window, but that would mean keeping track of sizes for everything that can be packed and unpacked, which is a lot of things. Too many in fact to be rational to do.
      all said and done, it sounds like this solution doesn't scale well to large apps. Randell
        I'm not sure exactly what you want, but it sounds like you are looking for a Tk::Adjuster. See Tk::Adjuster, how to keep proportions for maintaining ratios. Here is a simple example with no ratio.
        #!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Pane; my $mw = MainWindow->new(); my $pane = $mw->Scrolled('Pane', -sticky => 'nsew', -scrollbars => 'osoe', )->pack(-fill => 'both',-expand => 1); my $i; for ($i = 0; $i <= 5; $i++){ my $frame = $pane->Frame( -relief => 'ridge', -bd => 1,) ->pack(-side => 'top',-fill => 'both',-expand => 1); my $adjust = $pane->Adjuster(); $adjust->packAfter($frame, -side => 'top',-fill=>'both',-expand=>1); my $label = $frame->Label(-width => 30, -text => "Frame ". $i,)->pack(); } my $frame = $pane->Frame( -relief => 'ridge', -bd => 1,) ->pack(-side => 'top',-fill => 'both',-expand => 1); my $label = $frame->Label(-width => 30, -text => "Frame 6 ")->pack(); MainLoop;

        I'm not really a human, but I play one on earth Remember How Lucky You Are
Re: perltk autoresize following users resize
by Anonymous Monk on Aug 19, 2008 at 06:22 UTC
        I am still sifting through "Tk resize site:search.cpan.org" can you narrow down my search?
      Not sure what to learn from the change logs... I didn't see anything that would help in them... can you expand on that?