TAdvToolBar position on DockPanel

I have a number of ToolBars on a DockPanel, some of which are hidden or shown depending on the current mode of the program. The problem is if I show a ToolBar that had previously been hidden it reappears at an apparently random position in the DockPanel. Is there a way to specify the position of the ToolBar so that it always reappears at the same location? It is very un-user friendly if the user has to search all across the screen for a particular ToolBar every time he changes mode.

If you change the toolbar visibility, have you tried calling AdvDockPanel.ArrangeToolBars ?

I just tried that but it does not seem to make any difference. If I drag a ToolBar to be the left-most toolbar on the panel then repeatedly close it and show it again, it pops up each time one position further to the right

I cannot reproduce this. When toggling visibility, the toolbar remains at its position. And programmatically, I can move the toolbar by setting the .Left property.
toolbarposition

OK, Thanks Bruno, I will try to make a test app that reproduces the behaviour I see...

If you just show/hide the Toolbar it stays in the right place. However if you use ArrangeToolBars to close up the gap after hiding the ToolBar then, when the ToolBar is Shown again it re-appears one position to the right of where it was when hidden. I have made a test app to show this: https://we.tl/t-5pL5gV2NgL

If you first do arrange then the toolbars got new positions, so the hidden toolbar is added where there is place when it is made visible again.
If you want to restore at the location before hiding, i suggest to use AdvDockPanel.SaveToolBarsPosition to save the original position and use AdvDockPanel.LoadToolBarsPosition to restore the position.

OK, I will try that. Thank you!

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.