I have a problem with my toolbars in a MDIapplication.
Like I posted in an other thread, I want to hide/show toolbars dynamic.
The problem of using the hide/show commands for the toolbar is, that
they allways shown in CustomizeDlg for the bars. I solve this problem
by remove and add the toolbar in ToolbarList of CommandBarsObject. It's
work. But then there come the next problem.
To save the state, position, etc. for customizing I use local varibles.
That means, in one way (hide) save the old status and in the other
(show) read the status from the variables. Thats OK. I run this
procedure when the MDIChildWnd activate. So, if the user change the
active document, the toolbar shows/hide in order of the active
document.
When I close the application, I have to save the old status of the
toolbar. In that way, I make the toolbar visible and use the
SaveCommandBars(...) function for all my toolbars. Next time I open the
application the toolbar will be loaded by the LoadCommandBars(..)
function. Thats right.
And now the problem:
The application fired the WM_Activate Message, my handler in
CMDIChildWnd get it and try, for instance, to hide the toolbar. In that
way, the toolbar hasn't the right position in the DockingBar. So the my
variables get the wrong values and next time I show the toolbar, it
appears somewhere in the DockingBar. If the toolbar has to be visible
at start of the application, there is no problem. The bar is drawing at
the right place.
So I think, the problem is to calculate the placement of the toolbar
before the bar will be removed from the CommandBarList. Is it possible
to do that under my control??
Have a nice day
Bernd
|