Robin wrote:
···
Is it still doing this, or did you find what you were doing that caused it?
----
Some comments about the application. The skeleton is relatively simple,
2 Panels holding widgets packed with sizers in a SplitterWindow.
The left panel look like this:
class PanelLeft(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id, wx.DefaultPosition, wx.DefaultSize)
self.parent = parent
self.SetBackgroundColour(wx.RED)
#widgets
self.lc = MyListCtrl(self, wx.ID_ANY)
self.b1 = wx.Button(self, wx.ID_ANY, 'Remove')
self.b2 = wx.Button(self, wx.ID_ANY, 'Sort')
self.b1.Bind(wx.EVT_BUTTON, self.OnClick1)
self.b2.Bind(wx.EVT_BUTTON, self.OnClick2)
hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
hsizer1.Add(self.b1, 0)
hsizer1.Add(self.b2, 0, wx.LEFT, 10)
b = 10
vsizer1 = wx.BoxSizer(wx.VERTICAL)
vsizer1.Add(self.lc, 1, wx.EXPAND | wx.ALL, b)
vsizer1.Add(hsizer1, 0, wx.ALIGN_LEFT | wx.ALL, b)
self.SetSizer(vsizer1)
#very important
self.SetMinSize(self.GetBestSize()) <<<<<<<<<<<<<<<< line 80 in my code
def OnClick1(self, event):
...
My experience:
- If I comment the line <<<<<<< and the sash is, let say, at position 300,
the panel in the left pane is too broad and cover the right pane by a few
hundreds of pixels.
- Interestingly, this happens only during the initialization, if I later manually move the sash *a few times* and I have to, the panel just get fitted correctly.
- A correct fit is also realizef after minimyzin and restoring the window.
This seems to indicate some trouble during the initialization.
- Replacing the ListCtrl with an another widget shows the same effect.
- Swapping panels did not help.
- Setting a sash position in different programm places (Frame, main Panel) did not help.
- Testing with different sash positions, including -1. No success.
- I'have tried several things like Layout, SetSizerAndFit, brute force in setting dimensions of the controls in the left panel. No success.
until I introduce this magic line.
Sorry, cann't say more, it's working like this on w2k and XP.
Jean-Michel Fauth, Switzerland