Create problem

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
candid_1120
Earned some good credits
Earned some good credits
Posts: 118
Joined: Sun Aug 28, 2005 8:42 am

Create problem

Post by candid_1120 »

How to use Create to make a frame like that example:

class MyFrame:public wxFrame
{
....
};

MyFrame Mfrm=new MyFrame();

Mfrm->Show(true);

Thanks
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

???
Well, after creating the instance, simply call Mfrm->Create() and pass all the needed parameters (normaly the same as for the constructor).
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
candid_1120
Earned some good credits
Earned some good credits
Posts: 118
Joined: Sun Aug 28, 2005 8:42 am

Post by candid_1120 »

but I use new that it must be deleted,can wxWidgets to free it automaticly?

for example:

MyFrameA::func(...)
{
switch(...)
{
case 1: //to create a pointer of MyFrameB
case 2: //to create a pointer of MyFrameC
}
}

if I don't delete the pointer ,can wxWidgets to free it automaticly?
eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco »

candid_1120 wrote:if I don't delete the pointer ,can wxWidgets to free it automaticly?
If it has a parent or is a top-level window that lets its Close() destroy the window.
Post Reply