I'm using wxWidgets 2.7.2 and wxAUI shipped with it. Both compiled as DLLs.
I've a main frame managed by wxAuiManager. I need to save layout of panes on exit and restore it on next start. So, I'm calls wxAuiManager::SavePerspective in the destructor of the main frame, before wxAuiManager::UnInit(). And calls wxAuiManager::LoadPerspective in the constructor, after wxAuiManager::SetManagedWindow and all panes created. The string seems good, but LoadPerspective also returns false and all panes disappear.
How can I check what is wrong?
Kirix Support Forums
SavePerspective/LoadPerspective
7 posts
• Page 1 of 1
- Exhumer
- Registered User
- Posts: 4
- Joined: Mon Oct 23, 2006 4:36 am
- Location: Odessa, Ukraine
I found that value of the "name" in the load/save string is differ in each session.
That's why loading fails. The value seems like random set of digits. Any ideas?
- Code: Select all
"layout1|name=<value>;...
That's why loading fails. The value seems like random set of digits. Any ideas?
- Exhumer
- Registered User
- Posts: 4
- Joined: Mon Oct 23, 2006 4:36 am
- Location: Odessa, Ukraine
If you don't specify a name with the wxPaneInfo::Name() method, there's no way that LoadPerspective/SavePerspective() can associate your pane info with a window pointer, because window pointers (and much of the time window ids) are different each time you run. You need to add panes with names, like the wxaui sample does.
After this your LoadPerspective() call will work.
Best,
Ben
After this your LoadPerspective() call will work.
Best,
Ben
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Thanks a lot! Fixed it now.bwilliams wrote:If you don't specify a name with the wxPaneInfo::Name() method, there's no way that LoadPerspective/SavePerspective() can associate your pane info with a window pointer
But seems that this tip should be reflected in docs, because it's not evident.
- Exhumer
- Registered User
- Posts: 4
- Joined: Mon Oct 23, 2006 4:36 am
- Location: Odessa, Ukraine
Thanks a lot! Fixed it now.
But seems that this tip should be reflected in docs, because it's not evident.
Agreed!
Thanks,
Ben
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Re: SavePerspective/LoadPerspective
It appears that the example code doesn't set the AuiPaneInfo anymore, so the above mentioned problem occurs when attempting to use the perspective saving/loading.
Just for anyone who stumbles along this post, here's an example of what you would change to get it to work.
Replace
With
Just for anyone who stumbles along this post, here's an example of what you would change to get it to work.
Replace
- Code: Select all
m_mgr.AddPane(text1, wxLEFT, wxT("Pane Number One"));
m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Number Two"));
m_mgr.AddPane(text3, wxCENTER);
With
- Code: Select all
m_mgr.AddPane(text1, wxAuiPaneInfo().Name("Text1").Left().Caption("Pane Number One"));
m_mgr.AddPane(text2, wxAuiPaneInfo().Name("Text2").Bottom().Caption("Pane Number Two"));
m_mgr.AddPane(text3, wxAuiPaneInfo().Name("Text3").Center());
- daveisfera
- Registered User
- Posts: 1
- Joined: Mon Feb 09, 2009 3:19 pm
Re:
Ben wrote:If you don't specify a name with the wxPaneInfo::Name() method, there's no way that LoadPerspective/SavePerspective() can associate your pane info with a window pointer, because window pointers (and much of the time window ids) are different each time you run. You need to add panes with names, like the wxaui sample does.
After this your LoadPerspective() call will work.
Best,
Ben
This was my issue. I kept of believing it knew what I wanted it to do, when I actually had to tell it.
- jojosoto
- Registered User
- Posts: 6
- Joined: Fri Mar 25, 2011 12:39 pm
7 posts
· Page 1 of 1
Return to wxAUI Questions, Thoughts & Feedback