Drag 'n' drop in text fields
Posted: Mon Oct 28, 2019 10:18 pm
klaus posted elsewhere:
"Hi all,
quick question LC 9.5 on macOS 10.14.6:
We can drag'n'drop text into textfields and
this works without any scripting.
We can also drag'n'drop one or more files into
a textfield and the filepath appears in the field
where we dropped the file(s).
However there does not seem to be any message
send to the field when dropping a file, but I want
to catch it."
Here's a thought:
(code of the target field)
"Hi all,
quick question LC 9.5 on macOS 10.14.6:
We can drag'n'drop text into textfields and
this works without any scripting.
We can also drag'n'drop one or more files into
a textfield and the filepath appears in the field
where we dropped the file(s).
However there does not seem to be any message
send to the field when dropping a file, but I want
to catch it."
Here's a thought:
(code of the target field)
Code: Select all
local fldState
on mouseEnter
if fld "fff" is empty then put "0" into fldState
end mouseEnter
on mouseWithin
if fld "fff" is empty then
-- do nothing
else
put "1" into fldState
end if
if fldState > 0 then
set the textColor of fld "fff" to red
end if
end mouseWithin