I am implementing a simple drag and drop of a data file from the Mac Finder into a text field. I have a dialogue come up if the destination field already has something in it asking if I want to replace the data. The problem I am having is that when the dialogue comes up, the Mac Finder is active and LiveCode is not the active application since I dragged the file from the Finder. And this means I have to click the mouse twice to select an answer button.
So the question is: What is the script line to "select LiveCode" and make LiveCode the active app so that I don't have to click twice on the dialogue box (once to select LiveCode and once to click the button)?
Code: Select all
on dragEnter -- show a green outline around the drop target
set the borderColor of me to "green"
pass dragEnter
end dragEnter
on dragdrop
if the dragData["files"] is not empty and me is not empty then
beep
answer question "Replace with new data?" with "Cancel" or "OK" as sheet
-- select this stack -- here's the problem. How do I make LiveCode the app and not the Mac Finder?
if it is "Cancel" then exit dragdrop
end if
put URL ("file:" & line 1 of the dragData["files"]) into me
set the borderColor of me to empty
end dragdrop
on dragLeave
set the borderColor of me to empty
pass dragLeave
end dragLeave