I am working on a dockmanager style UI that follows the way Visual Studio 2008 implements the UI:
I need to create a tool similar to how VS2008 has the "Add New Data Source" which is in both the main menu and in a toolbar that is specific to the dock manager Data Source DockAreaPanel.
How would I go about doing this in the UI designer?
Sam
I see what you are trying to do. The problem is that if you have two different toolbar manager controls you are unable to share the same button object between the main toolbar and the toolbar in the docked area. Unfortunately there is no Dock Within Container property on the toolbar object so you end up having to create two different toolbar manager objects which kind of stinks.
I'm assuming you would like to manage your toolbars at design time instead of trying to do it at run time. What I normally do is when ever I have a toolbar I only use the tool click event to call the procedure that will actually handle the event. If you did the same thing in this scenario you wouldn't have to duplicate action code. In fact I was thinking that you could have the same tool click handler procedure handle both your docked toolbar manager control and the main toolbar manager control events. So long as the tool keys are the same for the buttons that are meant to be the same in each toolbar manager the same code would run whether they clicked the main toolbar button or the docked toolbar button. Finally if you used to same image list for each toolbar you could easily show the same button icons too without much hassle.
I follow you. One of the big things I really wanted to do is centralize the state of the different tools, looks to me like this cannot be done. Thank you!
I think the best thing for you to do is to create a "toolbar manager" manager class to add an intelligence layer to your toolbars in order to maintain state between them. I've done this in an application I am currently working on and it has worked well.
For lack of a better name I actually called my class ToolBarMgrManager. I've done this with all of the elements of my UI in order for them to act together as a whole unit. In my ToolbarMgrManager class I have classes that manages each of my toolbars, menus and menu items. When I raise an event in one of my other classes for example when I've succesfully made a database connection, all I do is call the EnableDatabaseConnectedMenus method and my toolbar manager class takes care of the rest. Actually I have an interface on my ToolMenu classes and they each impliment it so I just loop through each Toolmenu class and call the same method. The class also manages the states of my toolbars creating a logical relationship between them and other parts of my interface. You could do something similar to keep everything in check.
That seems very logical, thank you!