Page 1 of 1

Mouseleave doesn't show up on the message watcher

Posted: Mon Sep 02, 2013 4:59 pm
by laurpapo
Hey! I am having an issue getting the mouseleave handler to work. I have a program where a field gets created in the middle of a line graphic and the field is supposed to show up when the mouse is over the graphic, and disappear when the mouseleaves. The field is only disappearing about half the time when I move the mouse off of the graphic. I used the message watcher and often the mouseleave command doesn't even appear. This is the graphic's code:

Code: Select all

on mouseenter
   if the commented of me is true then
      put "Comment" & the short name of me into gCommentName
      show field gCommentName
   else if the commented of me is not true then
      set the outerglow["color"]of me to "red"
      set the outerglow["spread"] of me to 75
   end if
end mouseenter

on mouseleave
   if the commented of me is true then
      put "Comment" & the short name of me into gCommentName
      hide field gCommentName
   else if the commented of me is not true then
      set the outerglow of me to empty
   end if
end mouseleave
Any ideas?

Thank you!

Laurel

Re: Mouseleave doesn't show up on the message watcher

Posted: Mon Sep 02, 2013 6:57 pm
by dunbarx
Hi.

Have you perhaps not managed the value of your custom property? Because this works fine in a line graphic:

Code: Select all

on mouseEnter
   show fld 3
end mouseEnter

on mouseLeave
   hide fld 3
end mouseLeave
Try this, or simplify your own handler by commenting out all the extra lines. Then uncomment until it stops working.

Craig Newman

Re: Mouseleave doesn't show up on the message watcher

Posted: Mon Sep 02, 2013 7:54 pm
by SparkOut
This little stack works fine for me. I wonder if you're getting problems because of the mouse entering and leaving the graphic due to the field itself being shown or hidden which generates messages? I hit a recursion limit until I put a catch in for the mouseloc being within the field rect (inside the graphic) to stop a new mouseentter message being generated when the field disappeared and the mouse landed back in the graphic. If it's nothing to do with that, I'm not sure what you're facing.