mouseEnter/mouseLeave Problem
David Burgun
dburgun at dsl.pipex.com
Wed Apr 13 10:34:57 EDT 2005
Ok, thanks, I will take a look, but I would just lke to know why what
I have already doesn't work! What I have been trying to do as a
work-around is this:
--
-- When mouseDown is called the current "top" will be the last
selected Rectangle
-- Send a mouseLeave message to this Rectangle.
on mouseDown
put name of last graphic into myGraphicName
send "mouseLeave" to graphic myGraphicName
set layer of me to top
end mouseDown
This kind of fixes the problem in that if I click is the top most
rectangle (e.g. the layer is not changed) then the rectanges change
color as expected. If I click if the rectangle on the bottom, both
rectangles get changed to blue.
I am wondering if there is any way to wait for the send command to
complete? I am guessing that the set layer to top command is causing
the mouseLeave message to be missed or dropped?
Thanks for any help
Dave
>You might be able to rework this by catching the mousemove message in
>the card script or the stack script. Something like the following might
>work (untested, so it will prolly need some tweaking)
>
>On mousemove
> Global gBluelist
> If word 1 of the long name of the mousecontrol = "graphic" then
> Put the short name of the mousecontrol into tGraphic
> If gBluelist = tGraphic then exit mousemove
> If gBluelist <> empty then
> set the foregroundcolor of graphic gBluelist to black
> Put empty into gBluelist
> Set the foregroundcolor of graphic tGraphic to blue
> Put tGraphic into gBluelist
> Else
> Set the foregroundcolor of graphic tGraphic to blue
> Put tGraphic into gBluelist
> End if
> Else
> If gBluelist <> empty then
> set the foregroundcolor of graphic gBluelist to black
> Put empty into gBluelist
> End if
> End if
>End mousemove
>
>-----Original Message-----
>From: use-revolution-bounces at lists.runrev.com
>[mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of David
>Burgun
>Sent: Wednesday, April 13, 2005 7:08 AM
>To: How to use Revolution
>Subject: mouseEnter/mouseLeave Problem
>
>Hi,
>
>I have a script on a graphic rectangle object that does the following:
>
>on mouseEnter
>set foregroundColor of me to blue
>pass mouseEnter
>end mouseEnter
>
>on mouseLeave
>set foregroundColor of me to black
>pass mouseLeave
>end mouseLeave
>
>on mouseDown
>set the layer of me to top
>end mouseDown
>
>on mouseStillDown
>-- Move the object via the mouse, sets a new rect for the object
>based on mouse movement
>end mouseStillDown
>
>This works fine most of the time, however if I have two rectangle
>that overlap each other on the display, then when I move the mouse
>from one to the other, the mouseLeave handler does not seem to get
>called ***IF* I have moused-down in one of these objects. For
>instance:
>
>Both rectangles are set to black
>I move the mouse into into Rectangle A which is in front of Rectangle
>B. Everything works ok. The rectangles change from black to blue as
>expected. However if I do this:
>
>Both rectangles are set to black
>Move into Rectangle A - Changes to Blue
>Move into Rectangle B - A changes to Black and B changes to Blue (but
>B says behind A)
>MouseDown in Rectangle B - B moves in in front of A
>MouseUp in Rectangle B - (mouseStillDown may have been called)
>(Now Rectangle B is in Front and set to Blue, rectangle A is black)
>Move into Rectangle A - B does NOT go to black, the mouseLeave
>handler is NOT called, A gets changed to Blue, so both are set to
>Blue!!!
>
>Any ideas why mouseLeave is not being called? Seems to be after a
>MouseDown/Up sequence?
>
>Thanks a lot
>Dave
>
>
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
>_______________________________________________
>use-revolution mailing list
>use-revolution at lists.runrev.com
>http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list