GXT Button shows menu on first click, won't hide menu on second click?

I am guessing that it is working as intended since the menu always hides as soon as it loses focus. What I did below is override the onAutode method in the menu to not hide if the button with the specified ID is pressed (change accordingly). This gives me the ability to check if the menu is shown in the onClick method of the button - and then not show it again.Be warned though...I am in no way an expert and this is a hack :).

I am guessing that it is working as intended since the menu always hides as soon as it loses focus. What I did below is override the onAutode method in the menu to not hide if the button with the specified ID is pressed (change accordingly). This gives me the ability to check if the menu is shown in the onClick method of the button - and then not show it again.Be warned though...I am in no way an expert and this is a hack :) Button button = new Button("Test") { @Override protected void onClick(ComponentEvent ce) { ce.preventDefault(); focus(); hideToolTip(); if (!disabled) { ButtonEvent be = new ButtonEvent(this); if (!fireEvent(Events.

BeforeSelect, be)) { return; } if (menu! = null) { if (!menu.isVisible()) showMenu(); else hideMenu(); } fireEvent(Events. Select, be); } } }; button.

SetId("TESTBUTTONID"); Menu menu = new Menu() { @Override protected boolean onAutode(PreviewEvent pe) { if (pe.getEventTypeInt() == Event. ONMOUSEDOWN &&!(pe. Within(getElement()) || (fly(pe.getTarget()) .

FindParent(". X-ignore", -1)! = null)) &&!(fly(pe.getTarget()).

FindParent(". X-btn", -1)! = null && fly(pe.getTarget()).

FindParent(". X-btn", -1).getId() . EqualsIgnoreCase("TESTBUTTONID"))) { MenuEvent me = new MenuEvent(this); me.

SetEvent(pe.getEvent()); if (fireEvent(Events. Auto me)) { hide(true); return true; } } return false; } }; button. SetMenu(menu); RootPanel.get().

Add(button).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions