unexpected message passing
J. Landman Gay
jacque at hyperactivesw.com
Sat Jul 28 14:56:40 CDT 2007
Peter Brigham wrote:
> Here's a mystery -- to me, at any rate.
> In one of my stacks I have a button that changes its function when
> clicked with the optionkey down. To alert the user, I have mouseEnter,
> mouseLeave, and mouseMove handlers in the button script that change the
> label of the button accordingly. At some point I noticed that the button
> label stayed changed after option-clicking it -- the first thing that
> happens is an answer dialog, so the user moves the cursor off the button
> to deal with that, leaving the button label in changed mode. I could
> have made sure to change it back in the button script, but instead I put
> a mousemove handler in the stack script, so that the button would revert
> to the primary label whenever the mouse was outside the button.
Usually you'll also need an additional "mouseRelease" handler.
MouseRelease is sent when the user mouses down on one object but
releases the mouse over a different object. That should control the
situation where another object comes between your button and the mouse
while the mouse is still down. It'll avoid the need for the mousemove
> But then whenever I moved the cursor into the button with the optionkey
> down I'd get a rapid flicker between the two labels. I couldn't for the
> life of me figure out what was going on, as I do *not* have a pass
> mousemove command in the button script. BUT -- when I either comment out
> the stack mousemove script or put an empty blocking mousemove handler in
> the card script, the flickering stops. It looks as if the mousemove
> message is getting passed along the message hierarchy despite the lack
> of a "pass" command. How can this be?
I'm not sure, we'd need to examine the whole stack and script structure
to figure it out. Mousemove is, of course, sent repeatedly so you may
not be seeing the message being passed, but rather a new instance of
mousemove being sent.
> I looked at the message watcher with mousemove messages unsuppressed,
> and every time I moved the mouse one pixel inside the button rect
> with the optionkey down the label changes briefly to the base state
> then back to the altered state, and I got *two* mousemove messages:
> one "mousemove" and one "mouseMove" -- note the capital M.
I think I'd use Rev's "find" capabilities to search the scripts for all
instances of "mousemove". Look at each one that's found and note the
capitalization. That may give you a clue as to where the second instance
is coming from.
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode