Page 1 of 1

wxAUI Panel possible?

Posted: Thu Mar 19, 2009 3:39 am
by parad0x13
Is it possible to create a regular panel inside a wxAUI pane?

E.g. something of THIS sort:

Code: Select all

wxPanel panel(this, wxID_ANY);
m_mgr.AddPanel(panel, wxCENTER);
I know its ugly, but hopefully it gets my point across

- Thank Youz!

Posted: Thu Mar 19, 2009 3:54 am
by JimFairway
Hi,

I've not tried it, but I don't see why not.
Anything which derived from wxWindow can be added as a pane.


Jim

Posted: Thu Mar 19, 2009 3:55 am
by parad0x13
Well, I was wondering if anyone could submit code for this operation, or at least lead me in a direction that would show me how, I'm researching it right now but I don't see where I can add a panel to a pane right yet

Posted: Thu Mar 19, 2009 4:31 am
by parad0x13
Yeay! I've figured it out,

Code: Select all

m_mgr.AddPane(new wxPanel(this, wxID_ANY), wxCENTER);
Simple enough : )

Re: wxAUI Panel possible?

Posted: Thu Mar 19, 2009 4:58 am
by mc2r
I know you solved this already, but just a note on your original code.

parad0x13 wrote:

Code: Select all

wxPanel panel(this, wxID_ANY);
m_mgr.AddPanel(panel, wxCENTER);
This doesn't work because you are creating the panel on the stack not on the heap(with new).

Generally with 2 exceptions I can think of, in wxWidgets you want to do everything with new and pointers. This is because the parent of anything derived from wxWindow will try and destroy its children when it is destroyed.

the 2 exceptions I can think of right now(there maybe others before anyone flames me) are
1) modal dialogs. wxDialog mydialog

2) the paint dc in OnPaint.

This may have kind of worked(Not that I am recommending it)

Code: Select all

wxPanel panel(this, wxID_ANY);
m_mgr.AddPanel(&panel, wxCENTER);
but you might have run into strangeness when panel goes out of scope and then later it's parent is destroyed.

-Max