wxMax - Stopping a child resizing on a frame

BlitzMax Forums/Brucey's Modules/wxMax - Stopping a child resizing on a frame

Brucey(Posted 2008) [#1]
Gabriel wrote :

How would I go about recreating a MaxGUI window within a window for third party 3D engines to use? In MaxGUI, I create a canvas parented to the main window and pass the HWND. In WXWidgets, I create a WXWindow, parented to the main frame, but the 3D window fills up the entire frame, not just the window. So either I'm getting back the wrong Hwnd or my window is being resized or something.

EDIT: I can confirm that the window is definitely being resized and moved when TV uses it. Now a MaxGUI Canvas does not get resized or moved, so clearly this is a GUI thing, not a TV thing. How can I get a WXWindow to behave like a canvas in respect of not moving and not being resized?



I would try this :

Add a wxPanel to your frame. This will resize to fit the client area of the frame.
Now, add your custom wxWindow to the panel, setting both position and size. It *should* stick to the dimensions you set.

Generally, the child of a frame is designed to automatically always fit the frame.


Gabriel(Posted 2008) [#2]
Excellent! Thanks, man. So far so good with converting my level editor. I've managed to get images on tabs and everything, just like I had it with MaxGUI. I must say, the samples supplied are great because they cover an awful lot of ground.


Gabriel(Posted 2008) [#3]
On a related subject. Is it possible to give panels borders with captions the way you can in MaxGUI? I've tried setting the name and the label and passing the style wxCAPTION | wxBORDER_SIMPLE and I can get the simple border, but I can't get any text on it.


Gabriel(Posted 2008) [#4]
According to some docs I found, I should be using a wxDialogBox instead, but I don't see that. Has it not been wrapped yet or is it called something else now? I see wxDialog. Is that the same thing?


Brucey(Posted 2008) [#5]
Is it possible to give panels borders with captions the way you can in MaxGUI?

I missed this one, Sorry :-p

You want to use a wxStaticBox.
From the docs:
A static box is a rectangle drawn around other panel items to denote a logical grouping of items.

Please note that a static box should not be used as the parent for the controls it contains,
instead they should be siblings of each other. Although using a static box as a parent might work
in some versions of wxWidgets, it results in a crash under, for example, wxGTK.

Also, please note that because of this, the order in which you create new controls is important.
Create your wxStaticBox control before any siblings that are to appear inside the wxStaticBox
in order to preserve the correct Z-Order of controls.


Or you may prefer to venture into using wxSizers, for which there is a wxStaticBoxSizer, which essentially looks after the parent/child issue for you. eg, you can chuck a wxPanel inside it and attach buttons and whatnot to the panel. The sizer will worry about the panel sizing/layout etc.


wxDialog is a bit like a wxFrame, except it's not so much a main-window as your standard dialog type - those that popup during the running of your app for things like prefs, etc.
You'll notice that a wxDialog already has a panel and things built in, whereas a wxFrame is completely empty and ready to do with whatever you need.


Gabriel(Posted 2008) [#6]
Aha, perfect, thanks. I guess wxWidgets has had a few different versions as I keep coming across older docs trying to figure things out and everything has changed since then. That was exactly what I needed though. Thanks again.