problem with drag-dropping a text string (was: Re: use-revolution Digest, Vol 55, Issue 24)

Peter Brigham pmbrig at gmail.com
Tue Apr 15 23:20:23 EDT 2008


On Sun, 13 Apr 2008 17:22:50 +0200, Eric Chatonet  
<eric.chatonet at sosmartsoftware.com> wrote:

> Hi Colin,
>
> Le 13 avr. 08 à 16:01, Colin Holgate a écrit :
>> On Apr 13, 2008, at 4:45 AM, Eric Chatonet wrote:
>>
>>> on dragStart
>>>  set the dragdata["text"] to Transform(the selectedText) --
>>> end dragStart
>>> -----------------------
>>> function Transform pText
>>>  return pText && "modified"
>>> end Transform
>>
>>
>> This too would fail if you include a pass dragStart. I suppose
>> though that you would never pass dragStart normally?
>
> AFAIK this works with or without 'pass dragStart' unless you have
> another dragStart handler in the hierarchy that redefines the dragdata
> ["text"] and put a mess :-)
> But usually you don't need to pass this message.
>
> Best regards from Paris,
> Eric Chatonet.
> ----------------------------------------------------------------
> Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
> Email: eric.chatonet at sosmartsoftware.com/
> ----------------------------------------------------------------

In my tests, the dragData is empty if you try to get it in a  
dragstart handler. This seems to be confirmed by Mark's response to  
your bug report -- he says "When you receive a dragStart message, the  
'dragData' will be empty - so if
you want to mutate the data from a field (say) then you need to use 'the
selection' to get the currently selected text." Using the  
selectedText (or the selection) is the workaround I'm using:

on dragStart
   put the dragData["text"] into dd
   set the dragData["text"] to the selectedtext && "hello"
end dragStart

-- this works for me. But if I add a "pass dragStart" --

on dragStart
   put the dragData["text"] into dd
   set the dragData["text"] to the selectedtext && "hello"
   pass dragStart
end dragStart

then I get an untransformed drop. So passing the dragstart voids the  
transformation.

Also, the dragAction property when set in the dragstart handler  
doesn't appear to do anything. However, if I set the  
allowabledragactions to either "move" or "copy" in a dragstart  
handler, the appropriate copy or move is done -- *unless* I pass  
dragstart, in which case the current allowabledragactions is ignored  
and I get in all cases a move.

Eric, thanks for posting the bug report. There seem to be a lot of  
aspects to the dragdata and dragging that are either buggy, or don't  
work as I would expect, or are undocumented. I'm posting my  
observations to the QCC.

Peter M. Brigham
pmbrig at gmail.com


More information about the use-livecode mailing list