Help to implement behavior for popup widget.

38 views
Skip to first unread message

regnoult axel

unread,
May 27, 2012, 12:35:07 PM5/27/12
to google-we...@googlegroups.com
Hello, 

I do not succeed to implement condition (2) and (3) of my popup widget (it looks like a "rich" tooltip with links inside it)

(1) the popup is shown when the mouse is over the image (it is ok, I added MouseOverHandler on the image)
(2) the user can click on links that are inside the popup (so the popup does not desapear when the mouse is inside it)
(3) the popup is hidden when the mouse goes outside the image AND is not inside the popup.

Actually, I need to click outside the popup to hide it, and I tried to do it adding many mouseHandler and a Focus Panel inside the popup widget but I have not the result excepted. Maybe you will the see the solution more simple ? Thanks you.

jhulford

unread,
May 31, 2012, 11:43:58 AM5/31/12
to google-we...@googlegroups.com
What I do is add a mouse out/over handler to both the image and popup panel.

The mouse out handlers kick off timers that after, say, .25 seconds close the popup if it's open.  The mouse over handler on the popup cancels any close timers running and the mouse over handler on the image does the same and also kicks off a timer to show the popup after a short period of time (if the popup isn't currently showing).

Basically, that allows you to move your mouse between the image and the popup in a reasonable amount of time without the popup being closed automatically, but still does allow you to mouse out of the popup and still have it close automatically.
Reply all
Reply to author
Forward
0 new messages