How to Re-select LiveCode as the "live" app on a dragdrop?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
MouseUp
Posts: 41
Joined: Sun Feb 14, 2010 3:41 pm

How to Re-select LiveCode as the "live" app on a dragdrop?

Post by MouseUp » Tue Apr 23, 2013 11:00 pm

Hi LC Gurus,

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
Last edited by MouseUp on Wed Apr 24, 2013 9:46 pm, edited 1 time in total.
Thanks,

MouseUp

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: How to Re-select LiveCode as the "live" app on a dragdro

Post by Simon » Tue Apr 23, 2013 11:32 pm

Try resumeStack in the dropbox.

Simon
Edit: Sorry too fast
on resumeStack
focus on me
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5556
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to Re-select LiveCode as the "live" app on a dragdro

Post by jacque » Wed Apr 24, 2013 6:55 pm

Another option is just to not use a dialog box, which most operating systems are discouraging now anyway because they're intrusive. If the field already has content, don't allow a drop. Set the dragACtion to "none" on dragEnter.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

MouseUp
Posts: 41
Joined: Sun Feb 14, 2010 3:41 pm

Re: How to Re-select LiveCode as the "live" app on a dragdro

Post by MouseUp » Wed Apr 24, 2013 11:44 pm

Still no luck in getting LiveCode to be the active app via the script. Any more ideas?
Thanks,

MouseUp

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to Re-select LiveCode as the "live" app on a dragdro

Post by [-hh] » Sun Aug 04, 2013 8:17 pm

..........
shiftLock happens

Post Reply

Return to “Talking LiveCode”