A customer has tasked me with updating some of the UI elements in their application. Among the problems they listed was a redraw bug in Snow Leopard, where the controls on windows with a set background color would display a slightly different color in their background even with the Composite property set to True. After about an hour of testing different workarounds, I found what I believe to be an excellent solution.
In this application, all of the windows have a set background color, but only a few displayed the error. I had absolutely no luck in determining the difference, so I can only assume that it’s an inconsistent REALbasic bug. Here’s how I fixed it:
- Add a new object to your project, mine is named “WindowHack,” and set it’s Super to “Window.”
- Open the window subclass, and navigate to the “Paint” event.
- Inside the “Paint” event, add the following block of code:
#if TargetMacOS then
If Me.HasBackColor Then
g.ForeColor = me.BackColor
g.FillRect( 0, 0, g.Width, g.Height )
End If
#endif - Now set the Super of the windows with the problem to “WindowHack” and test.
This seemed to be the most elegant solution I could find to the problem and, quite honestly, the root of the issue still eludes me. Any thoughts on what might be causing this inconsistency?
Tags: bugs, class, clients, flicker, mac, osx, realbasic, ui