Window does not fit unless I resize...

Hi,

At some point in my program, a splitterwindow has to be destoyed and similar
one opened in its place. I have this in my code:

self.CreateMainWindow()#method for creating a new self.splitter

# do a lot of stuff

self.splitter.Show(False)
self.splitter.Destroy()
self.CreateMainWindow()
self.Refresh()

The first CreateMainWindow is called when the app first loads and it fits into
the frame nicely. However, when I try to replace it, the splitterwindow is
bungled on the top-left corner of the frame. When I resize a bit, it fits into
the frame. What am I doing wrong?

simon kagwe wrote:

Hi,

At some point in my program, a splitterwindow has to be destoyed and similar
one opened in its place. I have this in my code:

self.CreateMainWindow()#method for creating a new self.splitter

# do a lot of stuff

self.splitter.Show(False)
self.splitter.Destroy()
self.CreateMainWindow()
self.Refresh()

The first CreateMainWindow is called when the app first loads and it fits into
the frame nicely. However, when I try to replace it, the splitterwindow is
bungled on the top-left corner of the frame. When I resize a bit, it fits into
the frame. What am I doing wrong?

Try self.SendSizeEvent() or even self.SetSize(). I remember having had similar
problems and at least the latter helped.

Christian

simon kagwe wrote:

The first CreateMainWindow is called when the app first loads and it fits into

the frame nicely. However, when I try to replace it, the splitterwindow is
bungled on the top-left corner of the frame. When I resize a bit, it fits into
the frame. What am I doing wrong?

The fact that when you grab and resize the frame (even just a little) sets things straight is a sign that if that frame’s Layout() method were called, the same thing (the desired adjustment) would occur. Make sure it gets called on the Frame (or subclass thereof); if you call it on the frame’s children there may be no error but also no desired result.