Program doesn't exit when XRC LoadFrame is used 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
jsheets
Earned a small fee
Earned a small fee
Posts: 22
Joined: Wed Oct 19, 2005 1:21 pm

Program doesn't exit when XRC LoadFrame is used

Post by jsheets » Tue Feb 14, 2006 5:05 pm

Hello Everyone,

I'm experiencing some difficulty in using XRC, I'm using XRC to define a very basic frame and then use LoadFrame within the constructor of the frame.

The frame displays properly but unfortunately after the user closes the frame the program remains running even though there are no active frames and the main frame has been closed.

The program functions as expected when XRC is not used.

Any insight is appreciated.

Config:

wxWidgets 2.6.2 both static and DLL compliation

XRC File: http://ang.idahoimageworks.com/jas/ettool.xrc

Code: Select all

MainFrame::MainFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
    wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE)
{

    // normally done OnInit but placed here for simplicity
    wxXmlResource::Get()->InitAllHandlers();

    wxXmlResource::Get()->Load(wxT("resources/ettool.xrc"));

    wxXmlResource::Get()->LoadFrame(this, GetParent(), "MainFrame");
}

DavidHart
Site Admin
Site Admin
Posts: 3896
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart » Tue Feb 14, 2006 5:49 pm

Hi,

You're loading the frame twice. Once with the line : wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE) and then again with xrc.
Just do it the second way.

Regards,

David

Post Reply