problem with drag-dropping a text string

Mark Schonewille m.schonewille at economy-x-talk.com
Tue Apr 8 19:46:28 EDT 2008


Hi Peter,

This silly example works to drag and copy text from TextEdit into a  
Revolution field, in Mac OS X:

on dragDrop
   set the dragAction to "copy"
   put the dragData["text"] into myData
   replace "o" with "X" in myData
   put myData into me
end dragDrop

Just put the dragData into a variable and don't pass the dragDrop  
message.

Best regards,

Mark Schonewille

--

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

A large collection of scripts for HyperCard, Revolution, SuperCard and  
other programming languages can be found at http://runrev.info




On 9 apr 2008, at 00:34, Peter Brigham wrote:
> I am trying to modify the dragdata before a text string is dropped,  
> and it's not working, so I must be doing something wrong. The idea  
> is for the user to select some text from one field (unlocked), and  
> drag it to to a target field (unlocked), and I want to insert a tab  
> in place of a space in the text and drop the modified text into the  
> target field. Both fields are in the same group on the same card.  
> Here's my script (in the target field):
>
> on dragDrop
>  set the dragaction to "copy"
>  put the dragData into mLine -- works fine, so does using the  
> 'dragData["text"]'
>  set the itemdelimiter to tab
>  put item 2 of mLine into mChunk
>  put length(word 1 of mChunk) into w
>  put tab into char w+1 of mChunk
>  put mChunk into item 2 of mLine
>  set the dragdata to mLine
>  -- set the dragdata["text"] to mLine -- I tried this too
>  pass dragDrop
> end dragDrop
>
> There are no other handlers in the script, and no other dragdrop  
> handlers in the group, card, or stack scripts.
>
>
<snip>




More information about the use-livecode mailing list