Drag and drop from a list field
Bill Vlahos
bvlahos at mac.com
Tue Feb 27 23:03:13 EST 2007
Ken's suggestion works for making a text clipping on the desktop with
the both the name of the file and contents of the file whatever was in
the line of the field being dragged.
I need to intercept this and put something else in those places. In my
case the field is a list of names each of which represents a data
record (with multiple fields) but is not the complete data record in
the list field. I want to collect and format a vCARD from the data base
and have that be deposited as a vCARD on the desktop.
Bill Vlahos
On Feb 27, 2007, at 8:17 AM, Ken Ray wrote:
> On Mon, 26 Feb 2007 21:39:29 -0800, Bill Vlahos wrote:
>
>> Klaus has a great demo stack in RevOnLine on dragging and dropping a
>> file on the computer desktop into a field or stack. What I want to
>> know is how to drag and drop out of a list field onto the desktop.
>>
>> There is a sample drag and drop in the Rev docs using graphics
>> objects for dragging the name of a color graphic to another object on
>> the same card. Essentially the object has the script:
>>
>> on mouseDown
>> set the dragData["text"] to the short name of the target
>> set the borderWidth of the target to 3
>> end mouseDown
>>
>> on dragEnd
>> set the borderWidth of the target to 1
>> end dragEnd
>>
>>
>> I have two questions.
>>
>> 1. How do I get the content of the line of text (the one that is
>> selected) in a list field that I want to drag from?
>
> You could:
>
> set the dragData["text"] to the hilitedText of the target
>
> However, the cursor changes to be the "can't drag" cursor, even though
> you can drop the text into the Message Box or another app without a
> problem, so you'd have to change the cursor too:
>
> on mouseDown
> lock cursor
> set cursor to arrow
> set the dragData["text"] to the hilitedText of the target
> end mouseDown
>
> The problem with *that* is that you're releasing outside of the main
> card window, so no mouseUp/mouseRelease message will be sent. So you'd
> need to poll for the mouseState like this:
>
> on mouseDown
> lock cursor
> set cursor to 24 -- the drag cursor
> send "checkMouse" to me in 100 milliseconds
> set the dragData["text"] to the hilitedText of the target
> end mouseDown
>
> on checkMouse
> if the mouse is up then
> unlock cursor
> else
> send "checkMouse" to me in 100 milliseconds
> end if
> end checkMouse
>
>> 2. How do I send it outside the stack to the desktop to make a file
>> on the desktop?
>
> Well, if you're just dragging text, then the OS does it for you - when
> you drag text into the Finder (or Windows Explorer) and release, it
> will make a clipping file for you - basically it detects the type of
> dragData ("text" in this case), and handles it for you. However I don't
> know how to find out exactly *where* the file ends up. That is, what
> folder, etc. received the clipping.
>
> It would really be great if the "dragDestination" could be updated to
> contain this kind of information, but right now the destination can
> only be other objects in Rev.
>
> Anyone have any ideas on how to find out where the clipping was
> dropped?
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list