Aliasing in top left corner with Sizer::Add() Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
daniel3550
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Jul 26, 2018 10:26 pm

Aliasing in top left corner with Sizer::Add()

Post by daniel3550 »

I have a vertical sizer that I dynamically add more rows to. I have a text control box for user to enter number of rows. The handler creates new rows and adds them to vertical sizer using Sizer::Add(). After all rows are added it calls Layout() and Fit().

The end product is what I want, however while the rows are being created you can see text aliasing in the top left of the window. It seems all the rows are being placed on top of each other until I call Layout() and Fit() (or the handler exits, I'm not sure which one actually "clears" the top left corner). If I put bitmaps in my rows I can see remnants of them in top left corner as well.

How can I prevent the garbage showing up in top left corner?
aliasing.png
aliasing.png (5.98 KiB) Viewed 928 times
done.png
done.png (8.35 KiB) Viewed 928 times
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Aliasing in top left corner with Sizer::Add()

Post by doublemax »

First of all, unless you set the background color on purpose, the dark background seems to indicate that you've placed the controls directly onto the wxFrame instead of a wxPanel. The latter is the preferred way. You don't need an additional sizer for this, if a wxFrame has exactly one immediate child (in this case the wxPanel), it will automatically be stretched to fill the whole frame.

Regarding the redraw issue, wrap the adding code with wxWindow::Freeze() / Thaw() (on the parent panel), sometimes this helps.
Use the source, Luke!
daniel3550
In need of some credit
In need of some credit
Posts: 5
Joined: Thu Jul 26, 2018 10:26 pm

Re: Aliasing in top left corner with Sizer::Add()

Post by daniel3550 »

I added a wxPanel to the frame and still had the same problem.

Now instead of building the rows dynamically after user input, I have all the rows predefined and and use Show / Hide.
Post Reply