Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
880
Toolbar merging - how to hide a toolbar in one MDI child and show it in another?
posted

Hi,

I've got an MDI form with a toolbar and MDI child forms with toolbars that merge in. The merging of the tool items works fine.

I have a toolbar that is only present in the child form but sometimes it can be hidden and other times it is visible. The problem is that if I open a child window (A) where the toolbar is hidden first then the toolbar is never shown when I open the second child window (B, which doesn't hide it).

If I open child window (B) first then the toolbar is shown and is still shown when child window (A) is displayed (which explicitly hides the toolbar on load). The toolbar items in the toolbar are successfully hidden, it's just the toolbar that doesn't seem to pickup the visible property from the child window.

So opening one child form at a time looks okay, but when you try and have both open at the same time then what you see depends on the order you opened them.

Any ideas?

Thanks,

John.

Parents
No Data
Reply
  • 44743
    posted

    This is a actually expected behavior. When a merge takes place and new toolbars need to be created in the parent to represent those from the child, they will be created and initialized form the child toolbar. In other words, their properties (including Visible) will be copied from the child. But on subsequent merges, if the merge toolbar already exists, it is just used to host child tools. Properties are not copied back to it from the new child. It is the responsibility of the developer to perform these toolbar initializations on subsequent merges. This can be done by overriding OnMdiChildActivate in the MDI parent Form. Call the base implementation first, which will ensure the UltraToolbarsManagers are merged, and then initialize any toolbars in the parent.

Children
No Data