We have users which have tablets with attached monitors. If they set up and position the TAdvToolbars in a TAdvDockPanel while the monitor is attached and running the app in that monitor all is fine until they disconnect the monitor and run the app on the tablet since the tablet is showing the app at a different Windows display scaling, causing most if not all of the toolbars to collapse.
I am using the Persistence property of the dock panel but I would like to be able to save and load specific arrangements depending on how the user wants the toolbars for a particular resolution.
Do you have any recommendations on the best way to go about this? I was thinking of disabling the Persistence property and saving/loading on demand using SaveToolBarsPosition and SaveToolBarsPosition. Do I just update the Persistence.Section as needed before issuing those methods?
If you wish to persist several different settings, you could indeed set AdvDockPanel.Persistence.Enabled = false and then set AdvDockPanel.Persistence.Key (or AdvDockPanel.Persistence.Section) to a different value before manually calling SaveToolBarsPosition / LoadToolBarsPosition. This way you can save & load different settings.
If I used AdvDockPanel.Persistence.Enabled = true, it saves/restores the visible state of each button in a toolbar to/from an registry entry titled: UnDockedAdvToolBars. If I set it to false and use SaveToolBarsPostion it does not save/restore the visible state of the buttons.
I want to be able to save multiple button visible states along with each saved toolbar position. How can I do that? The positioning is working great, but now users cannot hide buttons they don't need. Even if visibility applies to all saved toolbars would be better than not saving/restoring it at all.
Looking at the code from AdvToolbar, it appears I have to enable Persistence and then call LoadPosition/SavePosition for each toolbar myself in order to save each button's visible state. This was in addition to the LoadToolBarsPosition/SaveToolBarsPosition for the dockpanel.
The Toolbar's SavePosition seems to use the Key from the AdvDockPanel when saving the position for a AdvToolbar, but ignores the Section value and always uses UnDockedAdvToolBars. The Persistence property of the TAdvToolbar is a protected property requiring me to have to set the "section" as part of the key, but only when saving/loading toolbar's position, not for saving/loading the AdvDockPanel's position.
Toolbar persistence is for toolbar position, it does not persist toolbar button visibility state.