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

Hi Tk/Monks,

I have a hierarchy something like this (not completely represented here, of course):

MainWindow Frame on left Frame at top Label Frame Labels... Frame at bottom Label Frame Labels... Frame on right

Pretty much all geometry managament is Form. (I come from a Motif background :-) ).

The problem is that the width of "Frame on left" is set by the contents of the FIRST child frame, "Frame at top". This means that if any of the texts of the labels in "Frame at bottom" are longer than the longest label in "Frame at top", they get truncated.

These texts do indeed vary, so it's not possible to fix it by, say, swapping "Frame at top" with "Frame at bottom".

So, what I'm looking for is a way to tell something high in my hierarchy (probably "Frame on left") to resize once "Frame at bottom" becomes populated. Or put another way, simply to resize when all the children have been realized (there's my Motif background coming through...!).

I've tried using -fill, -width (though I'd rather not hard-wire it); and I've thought about using other geometry managers, though I'm rather attached to Form. (attached, geddit? haha). Maybe Form's springs would help?

Any ideas? I've run out.

Thanks,

Dan (foxcorner)

Replies are listed 'Best First'.
Re: Tk container size question
by aquarium (Curate) on Oct 13, 2004 at 21:22 UTC
    i think you pack in reverse order of creation, which should do what you want.
      Thanks for the reply... but...

      (a) how do I reverse the packing order?, and (b) it's not necessarily what I want, because if the labels in the upper frame are longer than in the lower frame, I'll get truncated labels in the upper frame.

      I'm looking for "Please resize according to the sizes off all your children". Or something.

      Thanks,
      Dan

Re: Tk container size question
by qumsieh (Scribe) on Oct 14, 2004 at 03:16 UTC
    I've thought about using other geometry managers, though I'm rather attached to Form.

    I would go with this route. Form is probably the least frequently used geometry manager in Perl/Tk, and thus might contain bugs that have never been earthed before. This is the first time I see a question on form, and I have been a regular on comp.lang.perl.tk for many years.

    Maybe Form's springs would help?

    Perhaps, but I don't think so. The docs of form have this caveat:

    BUGS Springs have not been fully implemented yet.
    I would go with pack or grid.
      Thanks Gumsieh, I'll try pack or grid.

      The Form manager has been perfect for everything else in my GUI, though, so it'll be with some trepidation that I move to something else, because it'll feel like giving up some control. I'll experiment.

      Dan

        it'll be with some trepidation that I move to something else

        You don't have to give it up completely. It is perfectly fine to have different frames using different geometry managers to manage their children widgets. So, I would suggest you keep everything the way it is, and just change the necessary minimum to achieve your goals.