gwtmenuitemmenubarauto-close

GWT, disable autoclose MenuBar when clicking on MenuItem?


I want to if it is possible to disable the auto-close MenuBar when I click on a MenuItem? I have several MenuItem that are like checkboxes, so I can check more than one MenuItem and don't want my menu close everytime I checked one.

Thanks.


Solution

  • First, directly it's not possible because the popup-panel which displays the submenu is private in the MenuBar class.

    Buuut, there is a way to do so ...

    Simpley fetch the current MenuBar.java code out of googles code repository and include it in your eclipse gwt-project.

    You don't have to change anything e.g. package deklaration or something. Just put your source in your project and it will simply replace the original MenuBar-class from the gwt-sdk during compilation (works also with hosted development mode).

    Then you can simply set the property autoHide of the popup-Panel to false and the popup shouldn't disappear after clicking.