PDA

View Full Version : [FIXED] Popup not hiding -> ComponentEvent.type is not set



adam.schwartz
17 Jun 2008, 12:47 PM
I perused the forums a bit and didn't see this mentioned yet. Sorry for the spam if I missed it.

Using GXT beta 5 download, the Popup widget would not perform its autohide behavior correctly, so I opened it up and found that in handleEventPreview(ComponentEvent ce) the switch(ce.type) { ... } was never being entered. This is because ce.type isn't set correctly, so wherever ce.type is referenced I changed it to "ce.event.getTypeInt()". So the function now looks like this:

@Override
protected boolean handleEventPreview(ComponentEvent ce) {
switch (ce.event.getTypeInt()) {
case Event.ONMOUSEDOWN:
case Event.ONMOUSEUP:
case Event.ONMOUSEMOVE:
case Event.ONCLICK:
case Event.ONDBLCLICK: {
if (DOM.getCaptureElement() == null) {
if (!ce.within(getElement())) {
if (isAutoHide() && (ce.event.getTypeInt() == Event.ONCLICK) || ce.isRightClick()) {
if (navPopup.getIgnoreList() != null) {
for (int i = 0; i < navPopup.getIgnoreList().size(); i++) {
Element elem = (Element) navPopup.getIgnoreList().get(i);
if (DOM.isOrHasChild(elem, ce.getTarget())) {
return true;
}
}
}
if (onAutoHide(ce.event)) {
hide();
return true;
}
}
return false;
}
}
break;
}
case Event.ONKEYUP:
handleKeyUp(ce);
break;
}
return true;
}
};

...and it works now.

So someone who knows this codebase better than I ... does this sound like an appropriate workaround?

Cheers,
Adam

darrellmeyer
17 Jun 2008, 12:58 PM
Good timing on your find. Popup was refactored today and now uses BaseEventPreview internally. All the code you reference is now removed and auto hide now works.

Changes are in SVN.

adam.schwartz
17 Jun 2008, 1:00 PM
Great! Thanks for all the hard work Darrell.

Best,
Adam

adam.schwartz
30 Jun 2008, 12:09 PM
I'm still having no luck with a Popup auto-hiding, and spotty behavior with explicitly toggling hide/show. Even just creating a basic Popup in a viewport doesn't autohide:

public class SimplePopup implements EntryPoint
{
public void onModuleLoad()
{
final Viewport vp = new Viewport();
RootPanel.get().add(vp);

final Popup navPopup = new Popup();
navPopup.add( new HTML("VOILA!"));
navPopup.setSize(300, 300);
navPopup.showAt(30, 0);
}
}

After throwing in some debugging statements I notice hide() and afterHide() never get called. If I invoke hide() manually by overriding onAutoHide(), it works. If I subsequently call show() it will only reappear if setAnimate(true).

Am I missing something fundamental, or might this still be buggy?

Best,
Adam

ExtGWT version: Latest SVN build
Ubuntu Hardy, FF3

darrellmeyer
30 Jun 2008, 1:25 PM
There was still a few issues with Popup. Both bugs are fixed, changes are in SVN.