Drag and Drop

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Drag and Drop

Ray Horsley-2
I've never used this feature before and no matter how I set it up it seems kind of sporadic.  The goal is to drag an image file (jpg, jpeg, png, etc.) from the desktop onto a card, get the path to it and ultimately import it into the stack.  I've place an image control on the card which is the same dimensions as the stack itself and scripted the following:

on dragEnter
   set the dragAction to "copy"      -- this is the sporadic part which only sometimes turns the cursor into a plus thus allowing dragDrop to catch the drop
   pass dragEnter
end dragEnter

on dragDrop
   put the dragData into curFilePath
   -- continue to import the file
end dragDrop

This works 'some of the time' but I'm still often unable to drop what I'm dragging since the cursor doesn't always turn into the plus sign.  Each time this happens I try dragging the file again, immediately, and it suddenly works when I didn't change a thing.  What am I missing to get drag/drop working consistently?

Ray Horsley
LinkIt! Software
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Devin Asay

On May 9, 2013, at 6:15 AM, Ray Horsley wrote:

> I've never used this feature before and no matter how I set it up it seems kind of sporadic.  The goal is to drag an image file (jpg, jpeg, png, etc.) from the desktop onto a card, get the path to it and ultimately import it into the stack.  I've place an image control on the card which is the same dimensions as the stack itself and scripted the following:
>
> on dragEnter
>   set the dragAction to "copy"      -- this is the sporadic part which only sometimes turns the cursor into a plus thus allowing dragDrop to catch the drop
>   pass dragEnter
> end dragEnter
>
> on dragDrop
>   put the dragData into curFilePath
>   -- continue to import the file
> end dragDrop
>
> This works 'some of the time' but I'm still often unable to drop what I'm dragging since the cursor doesn't always turn into the plus sign.  Each time this happens I try dragging the file again, immediately, and it suddenly works when I didn't change a thing.  What am I missing to get drag/drop working consistently?

Ray,

A while back I needed exactly this. I worked out a process that seems to work consistently. Here's what I did:

In the card script:

on dragStart
    set the allowableDragActions to "move,copy"
end dragStart


In the drop target object script (mine happened to be a group):

on dragEnter
    set the dragAction to "move"  # "copy" might work, too
    # these next 3 lines are just eye candy to tell the user that they hit a "hot spot"
    set the lineSize of grc "dropSpot" of me to 3
    set the backcolor of grc "dropSpot" of me to "gray"
    set the icon of btn "downArrowBtn" to "downarrow"
end dragEnter

on dragDrop
    put the dragData["files"] into fld "file path"

    # more eye candy
    set the backcolor of grc "dropSpot" of me to the startingBackColor of grc "dropSpot" of me
    set the icon of btn "downArrowBtn" to "downarrowlite"
end dragDrop


on dragLeave
    # yet more eye candy
    set the backcolor of grc "dropSpot" of me to the startingBackColor of grc "dropSpot" of me
    set the icon of btn "downArrowBtn" to "downarrowlite"
end dragLeave

As you can see the essential parts of the drag-drop operation are fairly minimal and straightforward.

HTH

Devin


Devin Asay
Office of Digital Humanities
Brigham Young University


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

mwieder
In reply to this post by Ray Horsley-2
Ray Horsley <ray@...> writes:

> What am I missing to get drag/drop working consistently?

You might also want to look at

<http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop-to-the-mat-a-primer>

--
 Mark Wieder
 [hidden email]





_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Richmond Mathewson-2
On 05/09/2013 09:01 PM, Mark Wieder wrote:
> Ray Horsley <ray@...> writes:
>
>> What am I missing to get drag/drop working consistently?
> You might also want to look at
>
> <http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop-to-the-mat-a-primer>
>

Why do I always just use

on mouseDown
     grab me
end mouseDown

then set up a load of images as dropTargets and have stuff like this in
the grabbedObject:

on mouseUp
     if not within (img "target", the mouseloc) then
        set the loc of me to 857,673
     end if
end mouseUp

must be missing something.

Richmond.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

ScottR
Only you can know why you always use that technique, but with grab,
there's no way to act upon events/messages while grab is active (thus you
can't do cursor updates and provide user feedback), and you can't "grab"
an object across stacks.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 5/9/13 12:42 PM, "Richmond" <[hidden email]> wrote:

>On 05/09/2013 09:01 PM, Mark Wieder wrote:
>> Ray Horsley <ray@...> writes:
>>
>>> What am I missing to get drag/drop working consistently?
>> You might also want to look at
>>
>>
>><http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop-
>>to-the-mat-a-primer>
>>
>
>Why do I always just use
>
>on mouseDown
>     grab me
>end mouseDown
>
>then set up a load of images as dropTargets and have stuff like this in
>the grabbedObject:
>
>on mouseUp
>     if not within (img "target", the mouseloc) then
>        set the loc of me to 857,673
>     end if
>end mouseUp
>
>must be missing something.
>
>Richmond.
>
>_______________________________________________
>use-livecode mailing list
>[hidden email]
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode
>



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Devin Asay
> On 5/9/13 12:42 PM, "Richmond" <[hidden email]> wrote:
>
>> On 05/09/2013 09:01 PM, Mark Wieder wrote:
>>> Ray Horsley <ray@...> writes:
>>>
>>>> What am I missing to get drag/drop working consistently?
>>> You might also want to look at
>>>
>>>
>>> <http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop-
>>> to-the-mat-a-primer>
>>>
>>
>> Why do I always just use
>>
>> on mouseDown
>>    grab me
>> end mouseDown
>>
>> then set up a load of images as dropTargets and have stuff like this in
>> the grabbedObject:
>>
>> on mouseUp
>>    if not within (img "target", the mouseloc) then
>>       set the loc of me to 857,673
>>    end if
>> end mouseUp
>>
>> must be missing something.

Ray wanted to drag files onto stacks. Grab only works on objects inside a single stack.

On May 9, 2013, at 2:07 PM, Scott Rossi wrote:

> Only you can know why you always use that technique, but with grab,
> there's no way to act upon events/messages while grab is active (thus you
> can't do cursor updates and provide user feedback), and you can't "grab"
> an object across stacks.

That's mostly true, Scott. The only mouse message that gets sent during a grab is mouseMove. So you can check location, within() and other things during the grab operation and act on them within the mouseMove handler.

Devin


Devin Asay
Office of Digital Humanities
Brigham Young University


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Richmond Mathewson-2
In reply to this post by ScottR
On 05/09/2013 11:07 PM, Scott Rossi wrote:
> Only you can know why you always use that technique,

What? you expect me to know my own mind? LOL.

I use that technique as I tend to use a single stack, or a signle stack
with associated palettes.

>   but with grab,
> there's no way to act upon events/messages while grab is active (thus you
> can't do cursor updates and provide user feedback), and you can't "grab"
> an object across stacks.

Aha; got you.

Why do I have a funny feeling that you could use

mouseStillDown

to get feedback

Ha, ha,ha . . .  I just made a stack containing a button "DRAG ME ABOUT"

and a field "KOUNT"

in the button I have this script:

on mouseDown
    grab me
end mouseDown

on mouseStillDown
    put fld "KOUNT" into KOUNT
    add 1 to KOUNT
    put KOUNT into fld "KOUNT"
    wait 3 ticks
end mouseStillDown

on mouseUp
    put empty into fld "KOUNT"
end mouseUp

Try it, I dare you . . . you get feedback.

Richmond.


>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
>
> On 5/9/13 12:42 PM, "Richmond" <[hidden email]> wrote:
>
>> On 05/09/2013 09:01 PM, Mark Wieder wrote:
>>> Ray Horsley <ray@...> writes:
>>>
>>>> What am I missing to get drag/drop working consistently?
>>> You might also want to look at
>>>
>>>
>>> <http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-drop-
>>> to-the-mat-a-primer>
>>>
>> Why do I always just use
>>
>> on mouseDown
>>      grab me
>> end mouseDown
>>
>> then set up a load of images as dropTargets and have stuff like this in
>> the grabbedObject:
>>
>> on mouseUp
>>      if not within (img "target", the mouseloc) then
>>         set the loc of me to 857,673
>>      end if
>> end mouseUp
>>
>> must be missing something.
>>
>> Richmond.
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

ScottR
OK, I accepted your dare and was surprised to see that it worked (didn't
used to).  Nice.
Though you're still left with the limitations of working within a single
stack, and no dragging in or out.
But if the technique works for you, awesome.

Speaking as someone who has rolled custom drag-and-drop code (execute in
your message box):
go url "http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev"


...I'll suggest from experience that at some point it will benefit you to
get a handle on the built-in routines.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 5/9/13 1:36 PM, "Richmond" <[hidden email]> wrote:

>On 05/09/2013 11:07 PM, Scott Rossi wrote:
>> Only you can know why you always use that technique,
>
>What? you expect me to know my own mind? LOL.
>
>I use that technique as I tend to use a single stack, or a signle stack
>with associated palettes.
>
>>   but with grab,
>> there's no way to act upon events/messages while grab is active (thus
>>you
>> can't do cursor updates and provide user feedback), and you can't "grab"
>> an object across stacks.
>
>Aha; got you.
>
>Why do I have a funny feeling that you could use
>
>mouseStillDown
>
>to get feedback
>
>Ha, ha,ha . . .  I just made a stack containing a button "DRAG ME ABOUT"
>
>and a field "KOUNT"
>
>in the button I have this script:
>
>on mouseDown
>    grab me
>end mouseDown
>
>on mouseStillDown
>    put fld "KOUNT" into KOUNT
>    add 1 to KOUNT
>    put KOUNT into fld "KOUNT"
>    wait 3 ticks
>end mouseStillDown
>
>on mouseUp
>    put empty into fld "KOUNT"
>end mouseUp
>
>Try it, I dare you . . . you get feedback.
>
>Richmond.
>
>
>>
>> Regards,
>>
>> Scott Rossi
>> Creative Director
>> Tactile Media, UX/UI Design
>>
>>
>>
>>
>> On 5/9/13 12:42 PM, "Richmond" <[hidden email]> wrote:
>>
>>> On 05/09/2013 09:01 PM, Mark Wieder wrote:
>>>> Ray Horsley <ray@...> writes:
>>>>
>>>>> What am I missing to get drag/drop working consistently?
>>>> You might also want to look at
>>>>
>>>>
>>>>
>>>><http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro
>>>>p-
>>>> to-the-mat-a-primer>
>>>>
>>> Why do I always just use
>>>
>>> on mouseDown
>>>      grab me
>>> end mouseDown
>>>
>>> then set up a load of images as dropTargets and have stuff like this in
>>> the grabbedObject:
>>>
>>> on mouseUp
>>>      if not within (img "target", the mouseloc) then
>>>         set the loc of me to 857,673
>>>      end if
>>> end mouseUp
>>>
>>> must be missing something.
>>>
>>> Richmond.
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>>subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>_______________________________________________
>use-livecode mailing list
>[hidden email]
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode
>



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Ray Horsley-2
Many thanks to you all who responded to this thread I started earlier today.  Unfortunately I still haven't resolved this issue so any other thought are appreciated.  Here's a few responses to some of the ideas which were presented:

   -  The mouseDown and mouseStillDown unfortunately don't work since I'm dragging a file from the desktop to a Livecode stack (not beginning the drag action in Livecode) although that's kind of cool to know that mouseMove messages get sent during a grab.  I didn't know that.

   -  Doing anything with "on dragStart" also does not work since I'm starting the drag operation outside of Livecode (on a desktop file)

   -  Setting the dragAction to "copy" instead of "move" works better in my case since it adds a plus sign to the cursor (when it works) but still does not solve the intermittent failure of Livecode to accept the drop consistently.

   -  Thanks for the link to the article "Pinning Drag-and-Drop to the Mat" but I had actually read through it yesterday when I began wrestling with this.  It, too, does not address dragging files from the desktop into Livecode.

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'll continue to wrestle and post any solutions I find.

Thanks!

On May 9, 2013, at 4:59 PM, Scott Rossi wrote:

> OK, I accepted your dare and was surprised to see that it worked (didn't
> used to).  Nice.
> Though you're still left with the limitations of working within a single
> stack, and no dragging in or out.
> But if the technique works for you, awesome.
>
> Speaking as someone who has rolled custom drag-and-drop code (execute in
> your message box):
> go url "http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev"
>
>
> ...I'll suggest from experience that at some point it will benefit you to
> get a handle on the built-in routines.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
>
> On 5/9/13 1:36 PM, "Richmond" <[hidden email]> wrote:
>
>> On 05/09/2013 11:07 PM, Scott Rossi wrote:
>>> Only you can know why you always use that technique,
>>
>> What? you expect me to know my own mind? LOL.
>>
>> I use that technique as I tend to use a single stack, or a signle stack
>> with associated palettes.
>>
>>>  but with grab,
>>> there's no way to act upon events/messages while grab is active (thus
>>> you
>>> can't do cursor updates and provide user feedback), and you can't "grab"
>>> an object across stacks.
>>
>> Aha; got you.
>>
>> Why do I have a funny feeling that you could use
>>
>> mouseStillDown
>>
>> to get feedback
>>
>> Ha, ha,ha . . .  I just made a stack containing a button "DRAG ME ABOUT"
>>
>> and a field "KOUNT"
>>
>> in the button I have this script:
>>
>> on mouseDown
>>   grab me
>> end mouseDown
>>
>> on mouseStillDown
>>   put fld "KOUNT" into KOUNT
>>   add 1 to KOUNT
>>   put KOUNT into fld "KOUNT"
>>   wait 3 ticks
>> end mouseStillDown
>>
>> on mouseUp
>>   put empty into fld "KOUNT"
>> end mouseUp
>>
>> Try it, I dare you . . . you get feedback.
>>
>> Richmond.
>>
>>
>>>
>>> Regards,
>>>
>>> Scott Rossi
>>> Creative Director
>>> Tactile Media, UX/UI Design
>>>
>>>
>>>
>>>
>>> On 5/9/13 12:42 PM, "Richmond" <[hidden email]> wrote:
>>>
>>>> On 05/09/2013 09:01 PM, Mark Wieder wrote:
>>>>> Ray Horsley <ray@...> writes:
>>>>>
>>>>>> What am I missing to get drag/drop working consistently?
>>>>> You might also want to look at
>>>>>
>>>>>
>>>>>
>>>>> <http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro
>>>>> p-
>>>>> to-the-mat-a-primer>
>>>>>
>>>> Why do I always just use
>>>>
>>>> on mouseDown
>>>>     grab me
>>>> end mouseDown
>>>>
>>>> then set up a load of images as dropTargets and have stuff like this in
>>>> the grabbedObject:
>>>>
>>>> on mouseUp
>>>>     if not within (img "target", the mouseloc) then
>>>>        set the loc of me to 857,673
>>>>     end if
>>>> end mouseUp
>>>>
>>>> must be missing something.
>>>>
>>>> Richmond.
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

mwieder
Ray-

Thursday, May 9, 2013, 5:03:09 PM, you wrote:

>    -  Thanks for the link to the article "Pinning Drag-and-Drop
> to the Mat" but I had actually read through it yesterday when I
> began wrestling with this.  It, too, does not address dragging files
> from the desktop into Livecode.

Sorry - I missed that part in your post.

--
-Mark Wieder
 [hidden email]


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
--
 Mark Wieder
 ahsoftware@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

J. Landman Gay
In reply to this post by Ray Horsley-2
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         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Marty Knapp-2
I use a transparent button that covers the area I want to be able to
accept the drop. I use a dragEnter in the stack to show the button and
then hide it after dropping or exiting. You can give the button a border
as a visual indicator.

Best regards,
Marty Knapp
Knappster Solutions LLC
---------------------------
<www.CheckBuilderPro.com>


> 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.
>



_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

André Bisseret
In reply to this post by Ray Horsley-2
Bonjour Ray,

Recently I had a similar problem but while dragging from one locked field to an unlocked field on the same card.

The dragdrop handler did not work until I "pass dragdrop" at the end of the dragdrop handler.

Not sure that will help in your case!

Best regards

André

Le 10 mai 2013 à 02:03, Ray Horsley a écrit :

> Many thanks to you all who responded to this thread I started earlier today.  Unfortunately I still haven't resolved this issue so any other thought are appreciated.  Here's a few responses to some of the ideas which were presented:
>
>   -  The mouseDown and mouseStillDown unfortunately don't work since I'm dragging a file from the desktop to a Livecode stack (not beginning the drag action in Livecode) although that's kind of cool to know that mouseMove messages get sent during a grab.  I didn't know that.
>
>   -  Doing anything with "on dragStart" also does not work since I'm starting the drag operation outside of Livecode (on a desktop file)
>
>   -  Setting the dragAction to "copy" instead of "move" works better in my case since it adds a plus sign to the cursor (when it works) but still does not solve the intermittent failure of Livecode to accept the drop consistently.
>
>   -  Thanks for the link to the article "Pinning Drag-and-Drop to the Mat" but I had actually read through it yesterday when I began wrestling with this.  It, too, does not address dragging files from the desktop into Livecode.
>
> 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'll continue to wrestle and post any solutions I find.
>
> Thanks!
>
> On May 9, 2013, at 4:59 PM, Scott Rossi wrote:
>
>> OK, I accepted your dare and was surprised to see that it worked (didn't
>> used to).  Nice.
>> Though you're still left with the limitations of working within a single
>> stack, and no dragging in or out.
>> But if the technique works for you, awesome.
>>
>> Speaking as someone who has rolled custom drag-and-drop code (execute in
>> your message box):
>> go url "http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev"
>>
>>
>> ...I'll suggest from experience that at some point it will benefit you to
>> get a handle on the built-in routines.
>>
>> Regards,
>>
>> Scott Rossi
>> Creative Director
>> Tactile Media, UX/UI Design
>>
>>
>>
>>
>> On 5/9/13 1:36 PM, "Richmond" <[hidden email]> wrote:
>>
>>> On 05/09/2013 11:07 PM, Scott Rossi wrote:
>>>> Only you can know why you always use that technique,
>>>
>>> What? you expect me to know my own mind? LOL.
>>>
>>> I use that technique as I tend to use a single stack, or a signle stack
>>> with associated palettes.
>>>
>>>> but with grab,
>>>> there's no way to act upon events/messages while grab is active (thus
>>>> you
>>>> can't do cursor updates and provide user feedback), and you can't "grab"
>>>> an object across stacks.
>>>
>>> Aha; got you.
>>>
>>> Why do I have a funny feeling that you could use
>>>
>>> mouseStillDown
>>>
>>> to get feedback
>>>
>>> Ha, ha,ha . . .  I just made a stack containing a button "DRAG ME ABOUT"
>>>
>>> and a field "KOUNT"
>>>
>>> in the button I have this script:
>>>
>>> on mouseDown
>>>  grab me
>>> end mouseDown
>>>
>>> on mouseStillDown
>>>  put fld "KOUNT" into KOUNT
>>>  add 1 to KOUNT
>>>  put KOUNT into fld "KOUNT"
>>>  wait 3 ticks
>>> end mouseStillDown
>>>
>>> on mouseUp
>>>  put empty into fld "KOUNT"
>>> end mouseUp
>>>
>>> Try it, I dare you . . . you get feedback.
>>>
>>> Richmond.
>>>
>>>
>>>>
>>>> Regards,
>>>>
>>>> Scott Rossi
>>>> Creative Director
>>>> Tactile Media, UX/UI Design
>>>>
>>>>
>>>>
>>>>
>>>> On 5/9/13 12:42 PM, "Richmond" <[hidden email]> wrote:
>>>>
>>>>> On 05/09/2013 09:01 PM, Mark Wieder wrote:
>>>>>> Ray Horsley <ray@...> writes:
>>>>>>
>>>>>>> What am I missing to get drag/drop working consistently?
>>>>>> You might also want to look at
>>>>>>
>>>>>>
>>>>>>
>>>>>> <http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro
>>>>>> p-
>>>>>> to-the-mat-a-primer>
>>>>>>
>>>>> Why do I always just use
>>>>>
>>>>> on mouseDown
>>>>>    grab me
>>>>> end mouseDown
>>>>>
>>>>> then set up a load of images as dropTargets and have stuff like this in
>>>>> the grabbedObject:
>>>>>
>>>>> on mouseUp
>>>>>    if not within (img "target", the mouseloc) then
>>>>>       set the loc of me to 857,673
>>>>>    end if
>>>>> end mouseUp
>>>>>
>>>>> must be missing something.
>>>>>
>>>>> Richmond.
>>>>>
>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> [hidden email]
>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Richmond Mathewson-2
In reply to this post by ScottR
On 09/05/13 23:59, Scott Rossi wrote:
> OK, I accepted your dare and was surprised to see that it worked (didn't
> used to).  Nice.

Works in LC 4.5

Richmond.

> Though you're still left with the limitations of working within a single
> stack, and no dragging in or out.
> But if the technique works for you, awesome.
>
> Speaking as someone who has rolled custom drag-and-drop code (execute in
> your message box):
> go url "http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev"
>
>
> ...I'll suggest from experience that at some point it will benefit you to
> get a handle on the built-in routines.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
>
> On 5/9/13 1:36 PM, "Richmond" <[hidden email]> wrote:
>
>> On 05/09/2013 11:07 PM, Scott Rossi wrote:
>>> Only you can know why you always use that technique,
>> What? you expect me to know my own mind? LOL.
>>
>> I use that technique as I tend to use a single stack, or a signle stack
>> with associated palettes.
>>
>>>    but with grab,
>>> there's no way to act upon events/messages while grab is active (thus
>>> you
>>> can't do cursor updates and provide user feedback), and you can't "grab"
>>> an object across stacks.
>> Aha; got you.
>>
>> Why do I have a funny feeling that you could use
>>
>> mouseStillDown
>>
>> to get feedback
>>
>> Ha, ha,ha . . .  I just made a stack containing a button "DRAG ME ABOUT"
>>
>> and a field "KOUNT"
>>
>> in the button I have this script:
>>
>> on mouseDown
>>     grab me
>> end mouseDown
>>
>> on mouseStillDown
>>     put fld "KOUNT" into KOUNT
>>     add 1 to KOUNT
>>     put KOUNT into fld "KOUNT"
>>     wait 3 ticks
>> end mouseStillDown
>>
>> on mouseUp
>>     put empty into fld "KOUNT"
>> end mouseUp
>>
>> Try it, I dare you . . . you get feedback.
>>
>> Richmond.
>>
>>
>>> Regards,
>>>
>>> Scott Rossi
>>> Creative Director
>>> Tactile Media, UX/UI Design
>>>
>>>
>>>
>>>
>>> On 5/9/13 12:42 PM, "Richmond" <[hidden email]> wrote:
>>>
>>>> On 05/09/2013 09:01 PM, Mark Wieder wrote:
>>>>> Ray Horsley <ray@...> writes:
>>>>>
>>>>>> What am I missing to get drag/drop working consistently?
>>>>> You might also want to look at
>>>>>
>>>>>
>>>>>
>>>>> <http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro
>>>>> p-
>>>>> to-the-mat-a-primer>
>>>>>
>>>> Why do I always just use
>>>>
>>>> on mouseDown
>>>>       grab me
>>>> end mouseDown
>>>>
>>>> then set up a load of images as dropTargets and have stuff like this in
>>>> the grabbedObject:
>>>>
>>>> on mouseUp
>>>>       if not within (img "target", the mouseloc) then
>>>>          set the loc of me to 857,673
>>>>       end if
>>>> end mouseUp
>>>>
>>>> must be missing something.
>>>>
>>>> Richmond.
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Ray Horsley-2
In reply to this post by J. Landman Gay
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         |     [hidden email]
> HyperActive Software           |     http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Paul Hibbert-2
Ray,

Try moving your dragEnter & dragDrop to the card script (or the stack script), this works fine for me and I can't break it…

on dragEnter
   if char -3 to -1 of the dragData["files"] is among the items of "jpg,png,gif" then
     set the dragAction to "copy"
   end if
end dragEnter

on dragDrop
   put the dragData["files"] into tFilePath
   set the fileName of img "imageViewer" to line 1 of tFilePath
end dragDrop

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.

Paul

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         |     [hidden email]
>> HyperActive Software           |     http://www.hyperactivesw.com
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Alejandro Tejada
In reply to this post by Ray Horsley-2
Hi Ray,

Ray Horsley-2 wrote
[snip]
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?
And... This happens in every platform?
Windows? Mac? Linux?

Al
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Ray Horsley-2
Well I haven't tried Linux but this behavior happens on both Mac and Windows.

And Paul, thanks for the card script idea.  I started out trying things in the card script but when I got the sporadic behavior I decided it was because a card is technically not a control.  Not sure about that.  In any event I'm sorry to report the script you've given me still isn't stopping the cursor from remaining a circle with a line through it without changing to the plus sign.  I'll continue to experiment.  Have you tried really slowly dragging a file onto a stack window from the desktop to see if it changes to the circle with a line through it even though you've got this in your card's script:

on dragEnter
    set the dragAction to "copy"
end dragEnter

On May 10, 2013, at 11:55 AM, Alejandro Tejada wrote:

> Hi Ray,
>
>
> Ray Horsley-2 wrote
>> [snip]
>> 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?
>
> And... This happens in every platform?
> Windows? Mac? Linux?
>
> Al
>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Drag-and-Drop-tp4664563p4664662.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Richmond Mathewson-2
In reply to this post by ScottR
On 05/09/2013 11:59 PM, Scott Rossi wrote:
> OK, I accepted your dare and was surprised to see that it worked (didn't
> used to).  Nice.

Works in LC/RR 3.5.0

Works in LC/RR 2.2.1

So I don't know where you got the idea that this used not to work:
perhaps you never tried it as it never occurred to you.

Richmond.

> Though you're still left with the limitations of working within a single
> stack, and no dragging in or out.
> But if the technique works for you, awesome.
>
> Speaking as someone who has rolled custom drag-and-drop code (execute in
> your message box):
> go url "http://www.tactilemedia.com/site_files/downloads/TMdragndrop.rev"
>
>
> ...I'll suggest from experience that at some point it will benefit you to
> get a handle on the built-in routines.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
>
> On 5/9/13 1:36 PM, "Richmond" <[hidden email]> wrote:
>
>> On 05/09/2013 11:07 PM, Scott Rossi wrote:
>>> Only you can know why you always use that technique,
>> What? you expect me to know my own mind? LOL.
>>
>> I use that technique as I tend to use a single stack, or a signle stack
>> with associated palettes.
>>
>>>    but with grab,
>>> there's no way to act upon events/messages while grab is active (thus
>>> you
>>> can't do cursor updates and provide user feedback), and you can't "grab"
>>> an object across stacks.
>> Aha; got you.
>>
>> Why do I have a funny feeling that you could use
>>
>> mouseStillDown
>>
>> to get feedback
>>
>> Ha, ha,ha . . .  I just made a stack containing a button "DRAG ME ABOUT"
>>
>> and a field "KOUNT"
>>
>> in the button I have this script:
>>
>> on mouseDown
>>     grab me
>> end mouseDown
>>
>> on mouseStillDown
>>     put fld "KOUNT" into KOUNT
>>     add 1 to KOUNT
>>     put KOUNT into fld "KOUNT"
>>     wait 3 ticks
>> end mouseStillDown
>>
>> on mouseUp
>>     put empty into fld "KOUNT"
>> end mouseUp
>>
>> Try it, I dare you . . . you get feedback.
>>
>> Richmond.
>>
>>
>>> Regards,
>>>
>>> Scott Rossi
>>> Creative Director
>>> Tactile Media, UX/UI Design
>>>
>>>
>>>
>>>
>>> On 5/9/13 12:42 PM, "Richmond" <[hidden email]> wrote:
>>>
>>>> On 05/09/2013 09:01 PM, Mark Wieder wrote:
>>>>> Ray Horsley <ray@...> writes:
>>>>>
>>>>>> What am I missing to get drag/drop working consistently?
>>>>> You might also want to look at
>>>>>
>>>>>
>>>>>
>>>>> <http://lessons.runrev.com/s/lessons/m/4071/l/7124-pinning-drag-and-dro
>>>>> p-
>>>>> to-the-mat-a-primer>
>>>>>
>>>> Why do I always just use
>>>>
>>>> on mouseDown
>>>>       grab me
>>>> end mouseDown
>>>>
>>>> then set up a load of images as dropTargets and have stuff like this in
>>>> the grabbedObject:
>>>>
>>>> on mouseUp
>>>>       if not within (img "target", the mouseloc) then
>>>>          set the loc of me to 857,673
>>>>       end if
>>>> end mouseUp
>>>>
>>>> must be missing something.
>>>>
>>>> Richmond.
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Drag and Drop

Alejandro Tejada
Hi Richmmond,

Richmond Mathewson-2 wrote
[snip]
So I don't know where you got the idea that this used not to work:
[snip]
mouseStillDown is not mentioned in this article:
http://www.hyperactivesw.com/resources_polling.html

Why?

Al
12