wx.ScrolledWindow snapped to a side of the screen in Windows 7 causing some sizing issues

James Bunn wrote:

I've attached some example code that causes the problem. I've tested
this in Windows 7 Pro and on Windows 7 Home with the same (unwanted)
result. It does not cause a problem on Ubuntu 10.04.

Without the refresh on EVT_SIZE it causes some of the widgets to be
drawn incorrectly. Here's an example of what it looks like
(http://i.stack.imgur.com/tYEF4.png).

If you add a refresh to EVT_SIZE it fixes most of the sizing issues
except when you snap the Frame to half of the screen in MS Windows.
Here's an example of what that looks like
(http://i.stack.imgur.com/UKTPi.png).

What I can't figure out is why it keeps drawing the bottomrightPanel
incorrectly. It looks like it draws it from the bottom of that panel
instead of from the top. If you resize the frame at all it redraws it
correctly and give you the behavior you'd expect.

wxWidgets uses a feature of the Windows API which allows child window moves and resizes to be deferred until all changes have been made (in a deferred state,) and then they all happen for real all at once. Most of the time it helps a lot to reduce flicker and such, but once in a while it results in problems like what you've seen. It's like the paint events are happening before or during the deferred moves/sizes instead of after as they should be.

Unfortunately nobody has been able to figure out why this happens yet, so using a Refresh is the usual workaround. You probably don't need to do it for the whole frame though, just the panel where the problem is manifesting.

···

--
Robin Dunn
Software Craftsman