application not finalizing when top window closes
Chris Borgolte
wx at delta-h.de
Tue Apr 22 00:14:11 PDT 2008
personaje wrote:
> 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"));
>
Try replacing NULL with a pointer to your main frame.
> 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.
> _______________________________________________
> wx-users mailing list
> wx-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wx-users
>
More information about the wx-users
mailing list