Non-appearing control, maybe sizer related? 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
Morat20
Knows some wx things
Knows some wx things
Posts: 35
Joined: Tue Jan 07, 2014 8:43 pm

Non-appearing control, maybe sizer related?

Post by Morat20 » Wed Aug 07, 2019 8:10 pm

I'm using wxWidgets 2.9.5 (it is not something I can upgrade at the moment) and I have this weird, incredibly intermittent issue. On two separate panels (it's a wxNotebook) I have a single control (one a wxComboBox and one a wxStaticText) that, once I converted the previous static layout to a dynamic one, simply will not show up.

They are there -- you can actually click the combobox, if you know where on the screen it is, but it's not visible. The static text is also invisible, but clearly Show(true) because the sizer it's in allocates room for it. Something I tested by padding it with 200 pixels (and no wxRESERVE_SPACE flag) and seeing the large, blank area it should be in.

Removing them from the sizers STILL does not show them at -1,-1. I have verified there are no show(false) commands. Space is allocated. If it's an active control (like the wxComboBox) it can be activated if you click on where it "should" be.

I am at a loss. Why are these two controls not showing up? It doesn't appear to be sizer related, since removing them from the sizer's doesn't stack them in their default position. It's like they're just not being drawn on the screen. Just two controls, out of several dozen. Everything else works exactly as it should.

I don't even know what to look for. The layout is right, the control has space allocated for it as if it were visible. It's like that one, single control isn't being redrawn when it's told to Refresh() or Show(). In fact, if you switch to another wxNoteBook tab and back, you can see artifacts (whatever text or control occupied that space on the other tab) persisting where the 'invisible control is.

Any ideas on where to look? What to look for?

Morat20
Knows some wx things
Knows some wx things
Posts: 35
Joined: Tue Jan 07, 2014 8:43 pm

Re: Non-appearing control, maybe sizer related?

Post by Morat20 » Wed Aug 07, 2019 8:31 pm

Apparently adding a Freeze() and Thaw() (So Freeze, Layout, Refresh,Thaw) somehow made it work for the combobox. I'll mark it solved, even though I don't know what happened much less how it fixed it.

User avatar
doublemax
Moderator
Moderator
Posts: 14170
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Non-appearing control, maybe sizer related?

Post by doublemax » Wed Aug 07, 2019 9:27 pm

Things to check:
Do the controls appear when the outer frame gets resized?
Do the controls appear if you move a window from another application across yours?

The usual suspects are:
Missing/wrong Layout() call.
Wrong parenting
Overlapping siblings
Use the source, Luke!

Post Reply