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
140
Popup menu - how to hide drop down menu?
posted

I have a segmented toolbar popup menu that could have all the popup tools hidden due to user security rights. Is there a way to stop or remove the popup menu if it doesn't contain any tools? I don't want to remove the popup tool as the segmented option will always be required - it is just the empty popup I would like to remove.

Preferably I would like the empty popup menu to appear and operate as a button tool - no popup and no dropdown arrow.

Thanks in advance.

Aaron

  • 115
    posted

    something like this maybe....       

    Dim FileMenu As Infragistics.Win.UltraWinToolbars.PopupMenuTool = CType(tbMenuBar.Tools("File"), Infragistics.Win.UltraWinToolbars.PopupMenuTool)   

    Dim tbMenuBar As Infragistics.Win.UltraWinToolbars.UltraToolbar
            tbMenuBar = tb.ToolbarsManager.Toolbars("MenuBar")

    If FileMenu.Tools.Count = 0 Then
            tbMenuBar.Tools.Remove(FileMenu)
    End If

     

    ????

  • 44743
    posted

    If you want to get rid of the drop down arrow, the best way would probably be to define a ButtonTool that does the same thing as the button portion of the menu when it is clicked. The ButtonTool should be positioned next to the menu on the toolbar and have its Visible set to False. When the menu has no more menu items, hide the menu and show the button tool.

    Alternatively, you can stop the empty drop down from showing by handling the BeforeToolDropdown event and setting e.Cancel to True if the tool being dropped down has no menu items. However, with this approach, you will still see the drop down arrow.