dynamic sizer content problem in 2.4.2.4 (wi ndows 2k version)

Robin, thanks for the reply. I had a call to self.Layout(), but in my
attempts to find the solution, I also had a call to sizer.Fit(self) just
before, and that seems to screw things up, though I'm not sure why.

This is very confusing, I can never tell which feature of the sizer I should
be tweaking. The description of wxSizer.Layout() is fairly clear that it
should be called after adding/removing from the sizer, however it says
"while keeping the current dimension". Not sure what that means. What would
be an example of not wanting to keep the current dimension, and what would
have to be called instead (or in addition to) wxSizer.Layout()?

The wxWidgets doc need a topic on "Container dynamics" with a
"what-where-when-to-call" for window and sizer Layout(), Fit(), FitInside(),
RecalcMinSize(), etc.

Oliver

···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]

Schoenborn, Oliver wrote:
> Hello, I have a box sizer which contains a grid sizer and another box
> sizer. The grid is populated in two steps: first one row is created,
> then after the application frame is initialized, a few more rows are
> added. I add the rows by calling sizer.addWindow() several times, then I

> call self.Layout(), where self is the panel containing the outer box
> sizer. What happens is that the extra rows appear, but they are not
> sized properly. As soon as I resize the frame by even one pixel, they
> resize properly. I tried various combinations of self.sizer.Fit(),
> wxADJUST_MINSIZE etc but can't find the right way to do it. Anyone know
> what the "recipe" is for this? Couldn't find anything in online cookbook

> either.

Try calling sizer.Layout(), or self.Layout().

Schoenborn, Oliver wrote:

Try calling sizer.Layout(), or self.Layout().

Robin, thanks for the reply. I had a call to self.Layout(), but in my
attempts to find the solution, I also had a call to sizer.Fit(self) just
before, and that seems to screw things up, though I'm not sure why.

Calling sizer.Fit(self) will change the size of self to be what the sizer calculates to be the minimum size needed to show everything. If all you want is to relayout the contents in the existing space then calling Fit is definitly not what you want.

This is very confusing, I can never tell which feature of the sizer I should
be tweaking. The description of wxSizer.Layout() is fairly clear that it
should be called after adding/removing from the sizer, however it says
"while keeping the current dimension". Not sure what that means.

The current size of the window that owns the sizer.

What would
be an example of not wanting to keep the current dimension, and what would
have to be called instead (or in addition to) wxSizer.Layout()?

When you want the frame or dialog to be enlarged or shrunk to accomodate the new contents of the sizer. That is what Fit() is for.

···

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