application not finalizing when top window closes

personaje personaje at gmail.com
Mon Apr 21 14:24:38 PDT 2008


Hello everyone!

 I have an application and I create on OnInit my main frame.
 I have overriden CreateTraits and CreateLogTarget so I can create a
wxLogWindow.

 The problem is that when I close my main window the application
doesnt close, and If I do not create the logwindow it closes.

 MyApp::OnInit :

	MainTool* pMainTool = new MainTool;
	if (pMainTool)
        {
		wxGetApp()->SetTopWindow(pMainTool);
                return true;
        }

MyTraits::CreateLogTarget :

        wxLog::SetActiveTarget(wxGUIAppTraits::CreateLogTarget());
	wxLogWindow *plogwin = new wxLogWindow(NULL,wxT("Log"));
	wx_static_cast(wxApp*,wxApp::GetInstance())->SetTopWindow(plogwin->GetFrame());
	plogwin->Show();
	wxLog *plog = wxLog::GetActiveTarget();
	if (plog)
		plog->SetVerbose(true);
	return plogwin;

I haven't connected the close event on MainTool (only a destroy event)

What should I do to make it work? I would prefer not to create the
logwindow outside of the app class.

Regards.


More information about the wx-users mailing list