I dunno what I'm doing wrong here
I have a wxWindow as parent of two wxPanel. I switch between those two panels by calling hide and show respectively. When this hide/show thing is called by a mouse event, everything works great. But when I try to do this at runtime, called within another function, the new panel is shown, but the old one doesn't hide. Instead, widgets are strangely mixed , some hide, some not... calling layout or refresh doesn't help... anyone knows how to figure this out? I'd like to switch panels at runtime without the need of a mouse event
Show/Hide from parent element doens't completely hide children
-
- Super wx Problem Solver
- Posts: 466
- Joined: Tue Jun 20, 2006 6:47 pm
- Contact:
Re: Show/Hide from parent element doens't completely hide children
Are you sure all the controls in the panels have the panels as their parent? If the main wxWindow is set as the parent for a control, hiding the panel won't hide it.
Incidentally, if you're using 3.0, there's a new control called wxSimplebook which may or may not be helpful here.
Incidentally, if you're using 3.0, there's a new control called wxSimplebook which may or may not be helpful here.
Re: Show/Hide from parent element doens't completely hide children
Yes, I'm absolutely sure
- tierra
- Site Admin
- Posts: 1355
- Joined: Sun Aug 29, 2004 7:14 pm
- Location: Salt Lake City, Utah, USA
- Contact:
Re: Show/Hide from parent element doens't completely hide children
If you don't have both panels in a sizer, you should only have *one* panel as a child of any top level window, regardless of whether one is hidden or not. wxWidgets does some magic sizing for a single child window that isn't in a sizer, and you're likely confusing it. I would second the recommendation for wxSimplebook, or simply add your your panels to an appropriate sizer, and maybe even another parent panel that is always shown, and always the only child of your top level window.