wxAUI Panel possible? Topic is solved

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
parad0x13
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Jan 06, 2009 3:09 am

wxAUI Panel possible?

Post by parad0x13 » Thu Mar 19, 2009 3:39 am

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!

JimFairway
wxWorld Domination!
wxWorld Domination!
Posts: 1059
Joined: Sun Dec 30, 2007 6:40 pm
Location: Canada

Post by JimFairway » Thu Mar 19, 2009 3:54 am

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
OS: Vista SP1, wxWidgets 2.8.7.

parad0x13
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Jan 06, 2009 3:09 am

Post by parad0x13 » Thu Mar 19, 2009 3:55 am

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

parad0x13
Experienced Solver
Experienced Solver
Posts: 79
Joined: Tue Jan 06, 2009 3:09 am

Post by parad0x13 » Thu Mar 19, 2009 4:31 am

Yeay! I've figured it out,

Code: Select all

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

mc2r
wxWorld Domination!
wxWorld Domination!
Posts: 1195
Joined: Thu Feb 22, 2007 4:47 pm
Location: Denver, Co
Contact:

Re: wxAUI Panel possible?

Post by mc2r » Thu Mar 19, 2009 4:58 am

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

Post Reply