drag'n'drop in text fields

Klaus major-k klaus at major-k.de
Tue Oct 29 05:13:50 EDT 2019


Hi Hermann,

> Am 29.10.2019 um 00:55 schrieb hh via use-livecode <use-livecode at lists.runrev.com>:
> 
> Hi Klaus.
> 
>>> I wrote:
>>> on dragDrop
>>>  if "files" is among the keys of the dragData then
>>>    put line 1 of the dragData["files"] -- or whatever
>>>  end if
>>> end dragDrop
>>> 
>>> on dragEnter
>>>  set the dragAction to "copy"
>>> end dragenter
> 
>> You wrote:
>> .. also tried that, but then the pathname does not appear in the field.
>> I want to:
>> Drag'n'Drop a file into the field -> works without scripting
>> The pathname appears in the field and is definitively selected!
> 
> Three remarks.
> 1. the filename ends up in the message box if you dont use the "whatever" ;-)

I guessed! 8-)

> 2. textchanged is also a script ;-)

Yep, I meant without any "dragxxx" script. 
CoughnitpickerCough... ;-)

> 3. Your method doesn't work for locked fields, the following does:
> on dragDrop
>  if "files" is among the keys of the dragData then
>    put line 1 of the dragData["files"] into fn
>    focus on me; put the selectedChunk into sc
>    put fn into the selection
>    if sc is not empty then select char (word 2 of sc) to \
>          (word 2 of sc +len(fn)-1) of me
>  end if
> end dragDrop
> 
> on dragEnter
>  set the dragAction to "copy"
> end dragenter

Thanks, but my field is unlocked.

I reported the problem that "selectionchanged" does not get triggered:
<https://quality.livecode.com/show_bug.cgi?id=22433>


Best

Klaus

--
Klaus Major
https://www.major-k.de
klaus at major-k.de



More information about the use-livecode mailing list