I actually want CELayoutEditor to ask the user if he wants to save if he has pending modifications.
What I have is
Code: Select all
void EditorFrame::OnEditReload(wxCommandEvent& WXUNUSED(event))
{
const wxString filename = m_document->GetFilename();
m_document->OnCloseDocument();
m_document->OnOpenDocument(filename);
}
which gets called when you press a button I added to the tool bar.
However it crash within the
SetActiveLayout() call, something to do with the background
Code: Select all
bool EditorDocument::OnOpenDocument(const wxString& filename)
{
if ( filename.empty() || !wxDocument::OnOpenDocument( filename ) )
return false;
// Cleanup any current windows to avoid name clashes
WindowManager::getSingletonPtr()->destroyAllWindows ();
try
{
// Use the full path, because layouts can be loaded from everywhere.
CEGUI::Window* root = WindowManager::getSingleton().loadWindowLayout(StringHelper::ToCEGUIString(filename));
SetActiveLayout (root);
.
.
.
}
.
.
.
}
I simply want to do exactly the same as when you do File>Open> in the menu. However, I want to specify the document location instead of prompting the user. The document location will be
m_document->GetFilename()