wxMDIChildFrame MSWDestroyWindow
Franky Braem
f.braem at skynet.be
Wed May 16 11:19:24 PDT 2007
Vadim Zeitlin wrote:
> On Mon, 14 May 2007 17:28:37 +0200 Franky Braem <f.braem at skynet.be> wrote:
>
> FB> Vadim Zeitlin wrote:
> FB> > On Fri, 11 May 2007 21:11:26 +0200 Franky Braem <f.braem at skynet.be> wrote:
> FB> >
> FB> > FB> I run into an assert when I create a wxMDIChildFrame using Create with a
> FB> > FB> wxMDIParentFrame which is not yet created.
> FB> >
> FB> > This looks like a programming error to me. The parent should be created
> FB> > before the children, it's simply not going to work otherwise.
> FB>
> FB> Then why is there a default constructor where you don't need to specify
> FB> a parent?
>
> Because all wx GUI classes have a real ctor + a default ctor which can be
> used if you call Create() later. I won't claim that I'm entirely happy with
> this neither but it's not obvious to do it otherwise and, anyhow, this is
> something we'll just both have to live with.
>
> FB> When you use the default constructor and stop the program because
> FB> something else goes wrong, you get the assertion because the parent
> FB> wasn't set yet.
>
> I'm not sure I understand... why exactly does this happen?
Because JavaScript is an interpreted language, it is possible that an
error occurs and the script ends before create is called.
var mdiChild = new wxMDIChildFrame();
// When something goes wrong here in the script, I get an assertion
// in the dtor of wxMDIChildFrame because create wasn't called yet.
mdiChild.create(mdiParent, 1, "MDI Child test");
More information about the wx-users
mailing list