Drag command--does this seem right?

Devin Asay devin_asay at byu.edu
Wed Dec 21 15:38:58 EST 2016


Hi all,

I just accidentally discovered something curious:

Given a card with a any control object on it, and the following two handlers in the card script, the outcome is identical:

on mouseDown
  if the target <> me then
     grab the target
  end if
end mouseDown

on mouseMove
  if the target <> me then
     grab the target
  end if
end mouseMove

In other words, when you click down on an object that isn’t the card itself, the object follows the mouse until you release it.

This is not what I would expect. I would expect that the mouseDown handler works as I described, but that the mouseMove handler would grab a control as you moved over it and follow it around. I’m not saying that’s a desirable thing, just what I would expect.

The Dictionary says,”Use the grab command within a mouseDown handler to drag an object around the stack window without selecting it.” That implies that grab was only intended to work on mouseDown. When grab happens in a mouseMove handler it seems to generate an implicit mouseDown.

So my question is, is this a bug, a quirk, or a feature? If it’s a bug, I file a report.

Devin


Devin Asay
Director
Office of Digital Humanities
Brigham Young University



More information about the use-livecode mailing list