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
85
Popup Menu tool adding tools at runtime sometimes doesn't work.
posted

I've added a ribbon with a popup menu tool. When the form loads I populate it with items. These items are database driven.

So far everything is working fine.

During the use of the application different events might occur and I'll have to add even more items to the popup menu tool. When I do these items won't appear in the popup menu tool.

I add them to the manager first.

In fact, I can loop through the tools in the popup menu tool. And it'll say they are all there but only the first set is visible. So of course I checked there visual state and everything was in order.

I created another project with just a ribbon and a test to see if it was something with the project. At first it worked fine no matter when I added tools. So I thought it might be due to setting the compatibility mode or maybe that it was a mdi child form.

I started with the MDI child form idea and as soon as I added the child form. Each with their own ribbon and let them merge. The child form showed the problem again

Here is a screenshot of my test app. The text below shows info when I looped through tools.

I've included the application.

Add to Popupmenu.zip
  • 48586
    Verified Answer
    posted

    Hello ,

     

    Thank you for your sample. As far as I understand from your description, and as I was able to reproduce this, the issue is that when you add tool to the child form’s ribbon it doesn’t appear into the parent form’s ribbon. So to resolve this you should call RefreshMerge() of parent’s ribbon, after you have added your tools. So you could do this AddToll method of your Form2, so the code will lokks like:

     

    Dim tool As New ButtonTool(sKey)

            tool.SharedProps.Caption = sCaption

            Me.UltraToolbarsManager1.Tools.Add(tool)

     

            Dim toolPopupMenu As PopupMenuTool = Me.UltraToolbarsManager1.Tools("Add to Me Child")

            toolPopupMenu.Tools.AddTool(sKey)

            Me.UltraToolbarsManager1.MdiParentManager.RefreshMerge()

     

    Please let me know if you have any further questions.