Mouseleave doesn't show up on the message watcher

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Mouseleave doesn't show up on the message watcher

Post by laurpapo » Mon Sep 02, 2013 4:59 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10323
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Mon Sep 02, 2013 6:57 pm

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

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Mon Sep 02, 2013 7:54 pm

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.
Attachments
Test Mouseleave.zip
(812 Bytes) Downloaded 162 times

Post Reply