Back to Devexpress

How to Export a Toolbar From a Child Form to a Main Form

vcl-155061-expressbars-how-to-export-a-toolbar-from-a-child-form-to-a-main-form.md

latest1.7 KB
Original Source

How to Export a Toolbar From a Child Form to a Main Form

  • Dec 28, 2020

This topic explains how to copy toolbars from a bar manager located on child forms to the bar manager within the main form.

To create toolbars on a child form and then integrate them onto the main form, you must use the TdxBarManager.Merge method as shown below:

delphi
// ...
  // set the second parameter to True to create new toolbars in the
  // main form, if the bar captions of the main and child forms do
  // not match
  MaindxBarManager.Merge(ChilddxBarManager, True);
cpp
// ...
  // set the second parameter to True to create new toolbars in the
  // main form, if the bar captions of the main and child forms do
  // not match
  MaindxBarManager->Merge(ChilddxBarManager, True);

Note

You can omit passing the second parameter (which is True by default).

To “detach” toolbars, use the TdxBarManager.Unmerge method as shown below.

delphi
// ...
  MaindxBarManager.Unmerge(ChilddxBarManager);
cpp
// ...
  MaindxBarManager->Unmerge(ChilddxBarManager);

Note

We recommend that you use a bar manager on the main form when merging/unmerging toolbars. This allows you to dynamically change, display, and hide toolbars and menu items when a specific application window is displayed.

See Also

TdxBarManager.OnMerge

TdxBarManager.OnMergeItemLink