drag'n'drop in text fields
hh
hh at hyperhh.de
Mon Oct 28 19:55:08 EDT 2019
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" ;-)
2. textchanged is also a script ;-)
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
More information about the use-livecode
mailing list