Handling one MC message blocks another

depstein at att.net depstein at att.net
Sun Dec 26 04:30:25 EST 2004


Trying to understand how a mouseDown handler and a linkClicked handler coexisted or interacted, I conducted this test:

In a field script, write

on linkClicked
  put "c" after msg
end linkClicked

With the field unlocked, click with the command key down on a character of text of style "link".  The result is as expected.
	
Now add this "mouseDown" handler to the field script:

on mouseDown
  if the lockText of me then
    put "a" after msg
  else
    put "b" after msg
  end if
end mouseDown

When I command-click on the linked text, the result now is that the mouseDown message blocks the linkClicked message, so only the "b", not the "c", appears.  This is not a problem, since I can do what I need with either the mouseDown or the linkClicked handler, and don't need both.  (I don't find any mention of this behavior in the help files, though).  But here's what impressed me most:  If I remove the else clause of the mouseDown handler, it no longer blocks the linkClicked message (if lockText is true).  I can even keep the "else" and "end if" lines, with nothing in between, or with a "do empty" statement in between, and it won't block the linkClicked message.  

So MC's rule seems to be NOT "if there's a mousedown handler, don't send the linkClicked message"; it's "if there's a mousedown handler that takes any action, don't send the linkClicked message."  Very smart.  The same rule is followed if I lock the field, restore the second branch, and alternately activate and comment out the first branch of my "if" clause.

A more basic question is why any MC messages get blocked when other messages are handled.  Is there any comprehensive guide to which messages that happens with?

David Epstein


More information about the metacard mailing list