Text as dragImage
Devin Asay
devin_asay at byu.edu
Mon Mar 14 22:47:06 EDT 2011
Thanks, Monte, Marty and Colin for your suggestions.
I had mistakenly assumed that if a field was hidden a snapshot of the field would not show that field, but what was behind it. The dictionary entry for import snapshot is not as clear as is could be, but with a little trial and error I came up with this:
on dragStart
set the allowableDragActions to "copy"
set the dragAction to "copy"
set the dragData["private"] to word 2 of the clickLIne
put the clicktext into tText
put tText into fld "dragFld"
set the width of fld "dragFld" to the formattedWidth of fld "dragFld"
lock screen
import snapshot from (the long id of fld "dragFld" of this cd)
set the name of last image of this card to "dragImg"
hide img "dragImg"
unlock screen
set the dragImage to the id of img "dragImg"
end dragStart
on dragEnd
delete img "dragImg"
put the dragDestination into tDest
if tDest is empty then
beep
exit to top
end if
if the short name of tDest is "assignedStudents" then
put dragData["private"] into tLineToAdd
addNameToAssignedFld tLineToAdd
end if
end dragEnd
This works, but is there any way to prevent the standard "+" symbol icon from appearing during a drag drop operation?
\
Regard,
Devin
On Mar 14, 2011, at 7:17 PM, Monte Goulding wrote:
> Hi Devin
>
> Put your text into an invisible field with it's opaque and showborder false, set the size of it according to the formattedWidth/height to suit. Then import snapshot from control and use that image as the dragImage.
>
> Cheers
>
> Monte
>
> On 15/03/2011, at 12:02 PM, Devin Asay wrote:
>
>> Hi all,
>>
>> I'm creating a utility in which I want the user to be able to drag text from one field to another. I've worked out the details of dragging and dropping the text, but I also want to have the dragImage be a translucent copy of the text being dragged. I thought I remembered a discussion here about how to do that, but I haven't been able to find it. Has anyone done this? The effect should be similar to what you get in iTunes when you drag song title to a playlist.
>>
>> TIA,
>>
>> Devin
>>
>> Devin Asay
>> Humanities Technology and Research Support Center
>> Brigham Young University
>>
>>
>> _______________________________________________
>> 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
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list