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
120
Need to access Toolbar of Child form
posted

I have three Child Forms. Each has WinToolBar named TBCheck which is floating.

 

Now in Main form on clicking Show menu I want to set "Visible = True" property of toolbar TBCheck of the Active Child.

 

How to do it.

Parents
No Data
Reply
  • 44743
    posted

    I not really clear on your scenario, so I'm assuming the following things:

    • The main form is an mdi parent and the child forms are mdi children.
    • The main form has a toolbars manager and the child forms have their own toolbars managers and automatic mdi merging is turned on (as it is by default).
    • The "Show" menu activates an associated child form, which unmerges the last child manager and merges the manager associated with the newly active child form.
    • The user may hide the toolbar when one child form is active and you want it to always display when a new child form activates.

    Please let me know if any of these assumptions are incorrect.

    Based on these, I would say the best thing to do would be to override OnMdiChildActivate in your parent form. Call the base implementation of the method first. This will ensure the toolbars managers have already been merged. Then you can find the toolbar in the parent toolbars manager's Toolbars collection and set its Visible property back to True.

Children
No Data