Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ButtoMenuIcon Show/Hide Function

    Hello everyone. I am struggling for some time now with a problem. I have made a Toolstrip which has some ToolStripButtons. Every ToolStrip button has RibbonBar with a RibbonGroup in it and each RibbonGroup has IconButtons, like the image below.

    Click image for larger version

Name:	aaaaaaa.png
Views:	76
Size:	11.0 KB
ID:	264101
    Now, the last item of the group, since it has a submenu, is an IconButtonMenu. What I need to do is every time I press the down arrow if the menu is hidden, then should appear.And every time I press the down arrow if the menu i shown, then should hide.

    The problem is that the menu appears normally when I press first time the down arrow icon, but when I press it again, the menu is not hiding.

    I've tried to override the onMenuIconClickHandler of the IconMenuButton, but I cant make it work.

    Here is what I do:
    Code:
            versionMenu.setVisible(false);
            versionModeItem.addMenuIconClickHandler(new MenuIconClickHandler(){
    
                @Override
                public void onMenuIconClick(MenuIconClickEvent event)
                {
                    if(!versionMenu.isVisible()) {
                        versionMenu.setVisible(true);
                        versionMenu.show();
    //                    SC.say(versionMenu.getVisibility().getValue());
                    }
                    else {
                        versionMenu.setVisible(false);
                        versionMenu.hide();
    //                    SC.say(versionMenu.getVisibility().getValue());
                    }
                }
    
            });
    Where versionModeItem is my IconMenuButton and versionMenu is the menu that should be shown/hidden when user presses the down arrow.
Working...
X