[wxPython] Dyin' with a sizer problem...

Dyin’ with a sizer problem…

2.3.2 on Windows

Here’s my basic structure, indenting showing parenting of windows:

Frame

    Panel p with vertical box sizer

            Panel nav

            Panel stat

            Panel top, horizontal box sizer

                    Panel right, vertical box sizer

                            Panel logo

                            Panel task

                            Panel wflow

                    Panel viewer, grid sizer

The problem I am having is that from time to time I repopulate the

contents of the “task” panel, and I want panel “right” to resize to

take only as much space as it needs so that panel “viewer” will

expand or recede.

The initial layout is all correct and the contents of the panel are

changing correctly, but no matter what I’ve tried I haven’t been able

to make panels “right” and “viewer” adjust to the new contents.

I’ve tried:

    Calling Layout() on "right" and "top"

    Calling Fit() on everything

    Calling Layout() on the outermost frame

    Sending a resize event to the outermost frame

    Sending a resize event to "top"

    Adding "right"'s sizer instead of "right" to "top"'s sizer

Plus a couple hundred other variations.

The code is pretty complex, but if it is necessary I can spend some

time to snip out the relevant pieces. As far as I can tell i’m doing

all the setup of the sizers in the standard way. Any help would be

wildly appreciated. Thanks!

···

Jeff Kotula Sr. Principal Software Engineer

Vital Images jkotula@vitalimages.com

We’ve all heard that a million monkeys banging on a million

typewriters will eventually reproduce the entire works of

Shakespeare. Now, thanks to the Internet, we know this is

not true.

                     -- Robert Wilensky

You don't mention these particular possible actions (though it is likely they are in your "hundreds of others"), so I'll suggest them, just in case:

Make task's reported size change...

  task.Layout()
or
  task.GetSizer().Fit( task )

which, when you call frame.Layout() (or send a size event) should cause the sizer-set to properly resize all the windows to deal with the newly resized task window.

Good luck,
Mike

Jeff Kotula wrote:

···

2.3.2 on Windows

Here's my basic structure, indenting showing parenting of windows:

Frame
        Panel p with vertical box sizer
                Panel nav
                Panel stat
                Panel top, horizontal box sizer
                        Panel right, vertical box sizer
                                Panel logo
                                Panel task
                                Panel wflow
                        Panel viewer, grid sizer

The problem I am having is that from time to time I repopulate the
contents of the "task" panel, and I want panel "right" to resize to
take only as much space as it needs so that panel "viewer" will
expand or recede.

The initial layout is all correct and the contents of the panel are
changing correctly, but no matter what I've tried I haven't been able
to make panels "right" and "viewer" adjust to the new contents.

I've tried:
        Calling Layout() on "right" and "top"
        Calling Fit() on everything
        Calling Layout() on the outermost frame
        Sending a resize event to the outermost frame
        Sending a resize event to "top"
        Adding "right"'s sizer instead of "right" to "top"'s sizer
Plus a couple hundred other variations.

The code is pretty complex, but if it is necessary I can spend some
time to snip out the relevant pieces. As far as I can tell i'm doing
all the setup of the sizers in the standard way. Any help would be
wildly appreciated. Thanks!

-------------------------------------------------------------------------------------

Jeff Kotula Sr. Principal Software Engineer
Vital Images jkotula@vitalimages.com

We've all heard that a million monkeys banging on a million
typewriters will eventually reproduce the entire works of
Shakespeare. Now, thanks to the Internet, we know this is
not true.
                         -- Robert Wilensky

--
_______________________________________
   Mike C. Fletcher
   Designer, VR Plumber, Coder
   http://members.rogers.com/mcfletch/

The problem I am having is that from time to time I repopulate the
contents of the "task" panel, and I want panel "right" to resize to
take only as much space as it needs so that panel "viewer" will
expand or recede.

The initial layout is all correct and the contents of the panel are
changing correctly, but no matter what I've tried I haven't been able
to make panels "right" and "viewer" adjust to the new contents.

You may need to do some adjusting to the min size that the sizer has for an
item. For windows, the sizer will assume that its initial size is the
minimum size. So if your sub panels need to be resized then the parent
sizer that contains that panel will need to be notified. Something like
this:

    size = subpanelsizer.GetMinSize()
    parentsizer.SetItemMinSize(subpanel, size)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!