Trapping for mouseDown on the desktop on a Mac

Paul Hibbert paulhibbert at mac.com
Mon Oct 14 18:17:29 EDT 2013


Ray,

You don't need any dummy controls, I just adapted this stack from a previous one where I found that it is slightly quicker to use a hidden control and make it visible, rather than create a new one, although the speed improvements were noted with image objects not field objects, I just found it reduced the chance of errors if the user reacted quickly.

In this example the only control you may need is a behaviour button, but even that isn't necessary if you prefer to store the script elsewhere and apply it as you create the new field, I just think a behaviour is cleaner and simpler for debugging etc.

From my tests (and reading the dictionary), I found that the receiving control will need a script to deal with the 'dragDrop' message, I couldn't make this work with the 'dragDrop' handler at the card or stack level. The 'dragMove' is the important trigger in this case, that will need to be on the receiving card or stack, but the behaviour button can reside on a different card or stack, e.g. a library stack.

Paul

P.S. I've been called much worse names than Phil (With no disrespect to Phil). :-)

On 2013-10-14, at 12:19 PM, Ray wrote:

> Phil,
> 
> Many thanks for including this stack!  I'm in New York right now (out of town for me) but I'm anxious to get back home in a few days where I can experiment with this on my Mac.  Interesting how you've put the scripts in the card script but still need the field present to catch the message.  What I'd like to see is a stack with absolutely no objects in it receive the dragDrop message somewhere, either in the card script or the stack script.   But evidently we need to put 'dummy' controls like a field or an image on the card to trap for this message.  Please correct me if I'm wrong.
> 
> Thanks,
> 
> Ray
> 
> On 10/13/2013 2:55 PM, Paul Hibbert wrote:
>> Ken,
>> 
>> I don't think you even need to go into a polling mode, as soon as user drags an item onto a stack it triggers a 'dragMove' message so trapping that should work on both platforms.
>> 
>> Tried a few tests with a small stack and tackling the problem from a different angle seems to do the trick on OSX and Win7.
>> 
>> Ray, the test stack is here, hope it helps… https://www.dropbox.com/s/hddd6qx0vmilsot/Drag%20and%20Drop%20text.livecode - no restrictions on use!
>> 
>> Paul
>> 
>> On 2013-10-13, at 9:48 AM, Ken Ray wrote:
>> 
>>> How about going into a polling mode, checking the dragData["files"] every second or so... it should start out empty, but as soon as the user starts to drag a file from the desktop, it should have something in it.
>>> 
>>> Just a thought,
>>> 
>>> Ken Ray
>>> Sons of Thunder Software
>>> 
>>>> On Oct 12, 2013, at 11:25 AM, Ray <ray at linkit.com> wrote:
>>>> 
>>>> Phil - thanks for the suggestion but I just tried it and no-can-do. For some reason, and this is a Mac-only behavior, when I mouseDown on the desktop I can't see any messages at all which are sent to Livecode.  The suspend message is sent if I mouseDown on another stack, but not on a file on the desktop or the desktop itself.
>>>> 
>>>> Let me know if anything else comes to mind.
>>>> 
>>>> Thanks,
>>>> 
>>>> Ray
>>>> 
>>>>> On 10/12/2013 10:51 AM, Phil Davis wrote:
>>>>> Have you tried using 'suspend' instead of 'mouseDown' and 'suspendStack'? Should work the same on both platforms (famous last words!).
>>>>> 
>>>>> Phil
>>>>> 
>>>>> 
>>>>>> On 10/12/13 6:31 AM, Ray wrote:
>>>>>> On Windows the instant there is a 'mouseDown' on the desktop the current stack window goes inactive, thus triggering the suspendStack message.  I use this to create a field which then accepts dragDrops.  However, this is different on a Mac.  The current stack window on a Mac waits until the mouse comes up on a desktop click, thus defeating my scheme which creates the field to accept a dragDrop as soon as the mouse goes down on the desktop.
>>>>>> 
>>>>>> Any ideas anybody on how to trap for a mouse down on the desktop on a Mac?
>>>>>> 
>>>>>> Many thanks,
>>>>>> 
>>>>>> Ray
>>>>>> LinkIt! Software
>>>>>> 
>>>>>> _______________________________________________
>>>>>> use-livecode mailing list
>>>>>> use-livecode at lists.runrev.com
>>>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list