wxAUI saving a default perspective

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

wxAUI saving a default perspective

Post by Widgets »

Being new to wxAUI, I was wondering what the best way would be to save a default perspective in the wxConfig file.
At present I am able to save the current perspective on exit and restore it when the app restarts, but I am concerned how I would recover from a bad or corrupted perspective.
I realize that wxConfig has a default value which can be used to return a default value.
So, I guess, more precisely, the problem seems to be how to recognize when the restored perspective is bad and what, if any, way is a useful procedure to recover.

TIA for any advice or information.
Arnold
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: wxAUI saving a default perspective

Post by Widgets »

My latest conclusion is to save the last saved perspective to the default at startup.
That way the user should have a working perspective and a place to return to if he modifies his layout during the current session.
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: wxAUI saving a default perspective

Post by evstevemd »

Widgets wrote:Being new to wxAUI, I was wondering what the best way would be to save a default perspective in the wxConfig file.
At present I am able to save the current perspective on exit and restore it when the app restarts, but I am concerned how I would recover from a bad or corrupted perspective.
I realize that wxConfig has a default value which can be used to return a default value.
So, I guess, more precisely, the problem seems to be how to recognize when the restored perspective is bad and what, if any, way is a useful procedure to recover.

TIA for any advice or information.
Arnold
How I do it:
1. Save current perspective on Exit
2. On Startup after Main frame have loaded, save the perspective
3. Load perspective from config

I have a menu to reset perspective which user can use in case things are messed up. All it does is restore state that was stored at (2)
HTH
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: wxAUI saving a default perspective

Post by Widgets »

That sounds like a good alternative.
Unfortunately I was not quite happy with the default dimensions applied by my GUI builder.
Perhaps I'll have to review that process
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: wxAUI saving a default perspective

Post by Widgets »

Finally found out the REAL problem.
I had been using wxCrafter to build my GUI, but had not realized the importance of naming every item managed by the wxAuiManager.
Once I gave each panel & tool bar a unique name, saving and restoring works a LOT better.
This link https://groups.google.com/forum/#!topic ... uoIez0VDcQ got me going.
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Post Reply