Skip to main content

TdxBarManager.OnMenuMerge Event

Occurs when an MDI child form containing the main menu changes its state.

Declaration

property OnMenuMerge: TdxBarMenuMergeEvent read; write;

Remarks

When a child form changes its state (it’s activated, for instance), its main menu items are added by default to the end of the parent form’s main menu. To add child menu items to the parent menu in a specific manner, handle the OnMenuMerge event. For instance, you can insert items to arbitrary positions within the parent menu.

The Sender parameter references the bar manager of the MDI parent form.

The ChildBarManager parameter references the bar manager of the MDI child form.

AddItems indicates the operation being performed. Since the OnMenuMerge event fires for the complementary states, it’s important to know which action is currently running.

The AddItems parameter returns True, if the current MDI child form is activated or maximized. For these actions, the merge operation can be performed.

The AddItems parameter returns False, if the child form is deactivated, restored or minimized. These states are opposite to the ones above, and therefore the bars should be unmerged.

You can handle the OnBeforeMerge and OnAfterMerge events to update form elements in response to the operations you perform in the OnMenuMerge and OnMerge and OnMenuMerge event handlers.

Note

If the OnMenuMerge event handler is assigned, the parent form’s bar manager does not automatically merge child and parent menus. The OnMenuMerge event is fired before the OnMerge event and only when the AlwaysMerge property is set to True.

See Also