Popup show/hide toggle functionality with auto hide enabled

365 views
Skip to first unread message

Jonas

unread,
Mar 18, 2012, 5:31:56 PM3/18/12
to google-we...@googlegroups.com
I have a popup with setAutoHideEnabled (it automatically hides when you click somewhere outside of it).
I display it using a button but I want to have toggle functionality. First click shows the popup, then second
click on button hides it (but clicking somewhere outside also hides it). The problem is that when I click
the button the second time the popup first gets hidden because of auto hide and then is shown again.
Any ideas on how to solve this?

I also apply some styling on the button depending on popup visibility, so would like to remove the style when
the popup is hidden using autohide.

Jens

unread,
Mar 18, 2012, 5:49:58 PM3/18/12
to google-we...@googlegroups.com
Try using:

popup.addAutoHidePartner(yourButton.getElement());

This should disable the auto hide functionality when clicking on the button, so you can control the popup visibility yourself based on popup.isShowing() when clicking the button.

-- J.

Patrick Tucker

unread,
Mar 19, 2012, 11:33:55 PM3/19/12
to google-we...@googlegroups.com
Use a close handler to remove the style.
Reply all
Reply to author
Forward
0 new messages