The problem comes when saving and loading the perspectives.
Here's the code for the frame init:
- Code: Select all
AppFrame::AppFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, -1, title)
{
bool bRet;
bRet = wxXmlResource::Get()->Load(wxT("resources/mainmenu.xrc"));
if(bRet) bRet = wxXmlResource::Get()->Load(wxT("resources/projectpane.xrc"));
if(!bRet) {
Destroy();
return;
}
m_mgr.SetManagedWindow(this);
m_projectpanel = CreateProjectPane(); // Creates a panel and some objects inside
m_monitorpanel = wxXmlResource::Get()->LoadPanel(this,wxT("monitor_panel"));
m_effectspanel = wxXmlResource::Get()->LoadPanel(this,wxT("effects_panel"));
m_projectpanel->SetSize(200,300);
m_projectpanel->SetPosition(wxDefaultPosition);
// --- Begin wxAUI test ----
// create several controls
m_timelinepanel = new wxPanel(this, -1,
wxDefaultPosition, wxSize(800,400));
m_mgr.SetFlags(m_mgr.GetFlags() | wxAUI_MGR_ALLOW_ACTIVE_PANE);
// add the panes to the manager
m_mgr.SetDockSizeConstraint(0.3,0.45);
m_mgr.AddPane(m_projectpanel, wxLEFT,wxT("Project"));
m_mgr.AddPane(m_monitorpanel, wxBOTTOM,wxT("Monitor"));
m_mgr.AddPane(m_effectspanel, wxBOTTOM,wxT("Effects"));
m_mgr.AddPane(m_timelinepanel, wxCENTER, wxT("Timeline"));
m_mgr.Update(); // Up to this point everything's going fine.
{
wxCommandEvent tmpevent(wxEVT_COMMAND_MENU_SELECTED,idMenuLoadDefaultLayout);
wxPostEvent(this, tmpevent);
}
The part that loads the layout is the following:
- Code: Select all
// ... before this line, some code reads the perspective into strlayout. I checked, it's 806 bytes, just as the last perspective save.
bool result = m_mgr.LoadPerspective(strlayout,false);
if(result) {
wxMessageBox(_T("Layout loaded successfully"));
m_mgr.Update();
} else {
wxMessageBox(_T("Error loading layout!"));
}
What happens, is that the panes are created as usual, then I see the message "Layout loaded successfully". But after I click OK in the dialog box, all the panes disappear!
What am I doing wrong? Please help!!