wXWidgets: Change a Widget's Parent?

BlitzMax Forums/Brucey's Modules/wXWidgets: Change a Widget's Parent?

Gabriel(Posted 2008) [#1]
I'm having all kinds of problems keeping a wxWindow on top of a notebook with various panels attached, it seems to interfere with everything. So I'm trying to resolve that by parenting the window to the active tab. So I have connected a notebook event to intercept the tab changing, and here I want to move the wxWindow from one tab's panel to another, so that it is visible, regardless of which tab is active.

But I can't find a SetParent method. There's a GetParent, but no SetParent, so I'm not really sure what I can do here.


Brucey(Posted 2008) [#2]
There's a Reparent:Int(newParent:wxWindow) method.

Are you using a wxWindow as a "Window", or do you mean you have a wxWindow child on a wxFrame that loses Z-order against other children when you change tabs?


Gabriel(Posted 2008) [#3]
Ahh, thanks. Reparent seems to work fine.

It's wxWindow child on a wxFrame. Essentially the closest thing I could get to a MaxGUI canvas. A basic gadget with a hWnd to pass so that I can put a TrueVision3D context in it. It's parented to the panel which fills the frame, as is the notebook, but (oddly and initially I thought it was fortunate) it doesn't lose z-order as the panels are enabled and disabled. So I thought this would be a nice way to make the 3d graphics window available on all panels. But I'm getting a lot of random problems, particularly with wxFileDialogs which are opened with ShowModal ( they don't open at all! ) and I'm wondering whether this is because of my little quirk which has the TV3D window defying z-order. I'm going to try parenting it to each of the tabs and moving it between them as the tabs are activated, and hopefully that will stop me from having problems with filedialogs.


DavidDC(Posted 2008) [#4]
This sounds a lot like the problem I had with a glCanvas within a notebook control - at least if I'm reading you correctly. The glCanvas was at times drawing through all tabs (in os x - windows seemed ok). Flipping between tabs by hand would eventually get the drawing "right" - as in the correct tab contents would show and nothing else - but I never found an in-code solution. Eventually I took the easy way out and designed around the problem by removing canvases from notebook controls altogether.

I'll be interested in hearing how you go with this.