When a MDI child form is activated at run-time, its Toolbars will be merged with the toolbars contained in its MDI parent form. If two toolbars have the same key, the tools on those toolbars will be merged into one toolbar. (Any Toolbar that is set to be the main menubar for a form will be merged regardless of whether the keys are the same.)
When the two toolbars are merged, each tool from the MDI child is added to the toolbar in the MDI parent unless it has the same key and is the same type as a tool that is already present in the toolbar on the MDI parent. In this case, the MergeType property of the tool will determine what action is taken. Possible actions include Default, Add, Replace, MergeItems (for PopupMenuTools only) and Remove.
Note
|
Note
When there is a conflict between the MergeType settings of tools, the MergeType set for the tool on the child form takes precedence.
|
All tools start out with a MergeType of Default. When set to this value, the tool will take a default action, based on what type of tool it is. Most tools default to "Replace" but the value effectively works as "Replace or Add". The tool on the MDI child’s toolbar will replace the one on the MDI parent’s toolbar that has the same key and the same type, but if there is no such tool on the parent’s toolbar, the child’s tool will be added to the parent’s toolbar.
The PopupMenu tool has a default action of "MergeItems." This action will merge the tools contained in two menus that have the same key so that they appear on one menu.
The "Add" action causes the tool on the MDI child’s toolbar to appear in addition to the one on the MDI parent’s toolbar. Both tools remain available.
The "Remove" action will remove a tool from both the child and parent toolbar when the toolbars are merged. This gives you a way to override tools that are available on the parent toolbar. For example, if you have a tool that should be available on all MDI child forms but one, you can add the tool to that form and set its MergeType to "Remove". You would also place the same tool on the parent form’s toolbar to make it available for all other forms. When the child form with the tool becomes active, the tool is removed from the parent’s toolbar.
When the tools are merged into one toolbar, the MergeOrder property will be used to determine the order in which the tools are displayed. The collection of merged tools will be displayed in order of the value of their MergeOrder property. If two tools have the same MergeOrder, tools on the MDI parent will be displayed in their original order followed by tools on the MDI child in their original order.
At design-time, the MergeType properties for each tool can be set by right clicking on the UltraToolBarsManager element and selecting "Customize". Then select the tool under the Tools tab. The MergeType and MergeOrder properties will be available under SharedProps.