I was teaching a very newbie about LC, and made a simple stack to show how messages are sent and trapped. But in the first five minutes of building and demonstrating a simple button I ran into an anomaly that was embarrassing. The gadget I made just did not work perfectly.
Almost, but not perfectly. Embarrassing.
In the attached stack if one clicks on the button over and over one is supposed to see a random animal on "mouseDown", and a random number on mouseUp.
Code: Select all
on mouseup
put random(999) into field 1
end mouseup
on mouseDown
put any word of "cat dog bird worm roach lion" into fld 1
end mouseDown
If one catches one of these, then while holding the mouse down the random number from the previous mouseUp remains in the field, all day if I let it. If I finally release the mouse, the animal shows up for an instant and the the random number appears. The mouseDown message is sent only when I release the mouse, and then the mouseUp message is finally sent.
It never does the the other way around. If one waits even a half second between successive clicks, everything always works just fine.
What is freezing the mouseDown message when pressing quickly? I included a few "wait 0 (or 1 or 2) with messages" lines but they did nothing.
Craig