dynamic sizer content problem in 2.4.2.4 (windows 2k version)
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.
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().
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
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().
Is there a trick to making this work right on a wx.Dialog, BTW?
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().
Is there a trick to making this work right on a wx.Dialog, BTW?
They should work okay on a dialog. The only tricky thing is that on MSW wx.Dialogs don't get an initial size event if the size was set in the constructor (frame's do get an initial size event when they are shown and so they implicitly call Layout) so you may have to kickstart things with wxDialog by calling Layout from your __init__.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
They should work okay on a dialog. The only tricky thing is that on MSW wx.Dialogs don't get an initial size event if the size was set in the constructor (frame's do get an initial size event when they are shown and so they implicitly call Layout) so you may have to kickstart things with wxDialog by calling Layout from your __init__.
I've tried that. I've tried Layout() on the dialog and Layout() on its sizer. It's sizer (via .SetSizer()) is a GridBagSizer. On the theory that I might need to do some extra work I also preceeded it with a call to the sizer's RecalcSizes() method. None of it is having any effect.
I can supply the code if you need it - it's the rework I've been doing on the ErrorDialog class. But it's a real train wreck right now with half-implemented stuff scattered all about. Just yank my chain if you want it.
They should work okay on a dialog. The only tricky thing is that on MSW wx.Dialogs don't get an initial size event if the size was set in the constructor (frame's do get an initial size event when they are shown and so they implicitly call Layout) so you may have to kickstart things with wxDialog by calling Layout from your __init__.
I've tried that. I've tried Layout() on the dialog and Layout() on its sizer. It's sizer (via .SetSizer()) is a GridBagSizer. On the theory that I might need to do some extra work I also preceeded it with a call to the sizer's RecalcSizes() method. None of it is having any effect.
I can supply the code if you need it - it's the rework I've been doing on the ErrorDialog class. But it's a real train wreck right now with half-implemented stuff scattered all about. Just yank my chain if you want it.
As usual, a smaller example of the problem would be best.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!