Bug with hidden widgets on window creation/show

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
delt
Knows some wx things
Knows some wx things
Posts: 27
Joined: Mon Dec 26, 2016 11:17 pm

Bug with hidden widgets on window creation/show

Post by delt »

If a widget is hidden when the window is shown/created, showing this widget afterwards seems to stick it at the top level of the window, even if it's supposed to be in a (different?) sizer. Calling Layout () on my window doesn't change it. Is this behaviour expected?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Bug with hidden widgets on window creation/show

Post by doublemax »

Does the window "snap" to the right position when you resize the window? If yes, calling Layout() should fix it. If calling Layout on the frame doesn't help, try calling it on the topmost sizer.

If that doesn't help, please show some code, ideally a minimal, compilable sample that shows the problem.
Use the source, Luke!
delt
Knows some wx things
Knows some wx things
Posts: 27
Joined: Mon Dec 26, 2016 11:17 pm

Re: Bug with hidden widgets on window creation/show

Post by delt »

Calling topmost_sizer->Layout () solves the problem with hidden widgets being placed in the wrong sizer, thanks very much for that tip.

In another instance, in windows my widgets are taking only the top left 32 pixels of their tab page. Resizing the window "snaps" everything back into place, but calling Layout () on the window itself, and on various sizers/panels/etc. doesn't help. This works fine on linux and osx.
delt
Knows some wx things
Knows some wx things
Posts: 27
Joined: Mon Dec 26, 2016 11:17 pm

Re: Bug with hidden widgets on window creation/show

Post by delt »

(Note to self) Just spent half an hour futzing around with a similar case, it turns out an extra call to Layout () on a sizer was causing the same problem.

Sorry for bumping this thread, just got it from google search results searching for this issue (again). Adding this for documentation purposes.
Post Reply