drag'n'drop in text fields

Klaus major-k klaus at major-k.de
Mon Oct 28 17:40:31 EDT 2019


Hi Paul.

> Am 28.10.2019 um 22:34 schrieb Paul Dupuis via use-livecode <use-livecode at lists.runrev.com>:
> ...
>> 
>>> 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
>> thank you, 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!
>> 
>> However "the selectedtext of fld xyz" is reported to be empty
>> so is "the selection" and "the selectedchunk" returns the insertion point
>> right BEFORE the file has been dropped -> char 75 to 74 of fld xyz
>> 
>> I want to get that pathname from inside of the field = AFTER the file has been dropped.
> It sounds like a bug that should be reported. If there is text in a field (regardless of how it go there (paste, drag drop, typing, or by script) and it is selected, the the selection, selectedChunk,a dn all related properties should be set. If the text as placed in a field by any means other than script (paste, typing, drag drop) a textChanged message should be sent. I don't think textChanged is sent if a script changes the text.

YEAH, TEXTCHANGED is what I should use!
This does what I need:
----------------------------------
command doit
  put the selectedtext of me
end doit

on textChanged
  send "doit" to me in 10
end textChanged
------------------------------------
Thank you very much! :-)

However "selectionchanged" should also be triggered, not?


Best

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





More information about the use-livecode mailing list