Drag and Drop
lc at pbh.on-rev.com
Fri May 10 10:54:18 EDT 2013
Try moving your dragEnter & dragDrop to the card script (or the stack script), this works fine for me and I can't break it…
if char -3 to -1 of the dragData["files"] is among the items of "jpg,png,gif" then
set the dragAction to "copy"
put the dragData["files"] into tFilePath
set the fileName of img "imageViewer" to line 1 of tFilePath
With this method I see the cursor change to the circle with a line through it as soon as I drag an image onto the card, but then it changes to a green circle with a plus sign as soon as the app can accept the drop. i.e. When the cursor is over the (empty or not) image area.
On 2013-05-10, at 5:16 AM, Ray Horsley wrote:
> Very interesting point Jacqueline. In my case my image control displays nothing. I use it as a template, ultimately to make images out of what users drag and drops. It's the same dimensions as the stack itself. Since the image control displays nothing as it isn't linked (the FileName of it) to any file I'm not sure whether the whole thing is consider transparent pixels or not. Livecode doesn't seem to have a setting of transparent or opaque for image controls. So I've experimented with buttons giving them the same script as the image has:
> on dragEnter
> set the dragAction to "copy"
> pass dragEnter
> end dragEnter
> The new thing I've discovered is I can consistently break Livecode's accepting the drop, evidenced by the cursor turning into a circle with a line through it instead of a plus sign, if I drag extremely slowly right at the point where I stop dragging across the desktop and start dragging over the stack window. This happens even if I let the button overlap off the stack window. If I continue dragging around on top of the stack to another button with the same script I do get the plus sign for a cursor. Weird isn't it?
> On May 9, 2013, at 9:14 PM, J. Landman Gay wrote:
>> On 5/9/13 7:03 PM, Ray Horsley wrote:
>>> At the end of the day I'm wondering if this should be reported as a
>>> bug. It seems like something is getting hooked in memory. It's
>>> weird that I can drag a file onto my Livecode stack (which is one
>>> large image control with the drag handlers in it) and get nothing.
>>> Then, simply continuing to drag off the stack window and right back
>>> on it fixes it.
>> I wonder if it is because you are dropping onto an image. Images don't register mouse events unless you click (or presumably release) on an opaque pixel. It may be that sometimes you're dropping onto a transparent area and then nothing will happen.
>> You could test the theory by putting a big button over the card and seeing if the drop is reliable there, or by always consciously dropping exactly on an opaque area.
>> Jacqueline Landman Gay | jacque at hyperactivesw.com
>> HyperActive Software | http://www.hyperactivesw.com
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode