Question relative to popup and mouseListener...

25 views
Skip to first unread message

regnoult axel

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

I have a solution I can not find. I want to create a custom widget whick looks like a kind of "rich" tooltip (it is a exactly a popup in my case) that appear when my mouse is over the image. I have various behaviors for this widget :

(1) if the mouse is over the image so the popup appear (it is ok, I do it adding a MouseHandler on the image).
(2) the user can click on links that are inside the popup (so the popup do not desapear when the mouse goes inside it)
(3) if the mouse goes out of the image (and is not obviously inside the popup) so the popup must desapear.

My problem is that I do not succeed to implement behavior (2) and (3)...Actually, I have to do a click outside the popup to close it, and I just want the popup to be automatically closed when my mouse goes out of it. I tried to find a solution, but the code becomes complex, using focusPanel, and adding mouseHandlers with conditions...Maybe the solution is quite simple ?

Thank you for the help.

 
 - 

Joseph Lust

unread,
May 30, 2012, 4:04:43 PM5/30/12
to google-we...@googlegroups.com
Axel,

Just use onMouseOut event on your popup to close it. When you open the popup, make sure it is place under the cursor at that time. If it is proving more elaborate than that, could you post code and challenges here?

You can also use CSS3 transitions to easily add fade outs and delays to the onMouseOut action.

Sincerely,
Joseph

regnoult axel

unread,
Jun 7, 2012, 5:01:48 PM6/7/12
to google-we...@googlegroups.com
Hi Joseph,

I think you give me a trick here (the mouse under the popup from the begining)...but it does not solve my problem, because, for design reason, I need to adjust the popup position (and it will not be just under the mouse position).

I think, it should be have an invisible panel, greater than the original one, in order to listen the events.

Cheers,

regnoult axel

unread,
Jun 8, 2012, 1:17:15 AM6/8/12
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages