Drag and drop to desktop
Posted: Fri Mar 13, 2015 10:04 pm
Hi, I'm working on an IDE extension. One of the first things I need to be able to do is drag an icon from my new tool panel out to
the open space and create a stack when released.
This is the code I have so far. The problem is that, when I release the drag, it pops the mouse back to the start position of
the drag and creates there rather then at the end position. I suspect that is because I am not dragging onto a destination object
since I am trying to make a new stack. How can I get the release point when its not over a LiveCode object?
the open space and create a stack when released.
This is the code I have so far. The problem is that, when I release the drag, it pops the mouse back to the start position of
the drag and creates there rather then at the end position. I suspect that is because I am not dragging onto a destination object
since I am trying to make a new stack. How can I get the release point when its not over a LiveCode object?
Code: Select all
on mouseDown
set the dragData["text"] to empty
end mouseDown
on dragStart
set the dragImage to the id of the target
end dragStart
on dragEnd
CreateNewDBStack("New Databse Stack", "Default.sdb")
end dragEnd
command CreateNewDBStack pNewStackName, pDBname
#create stack
create stack pNewStackName
put it into tTheNewStack
set the loc of tTheNewStack to the mouseloc
set the DBPath of tTheNewStack to pDBName
#create DBscript on stack
local tScript
put "global gDBConnectionID"&cr into tScript
put "command onPreOpenStack"&cr after tScript
put " library stack ""e&"DatabaseLibrary.livecode""e&cr after tScript
put " put the DBPath of me into tDBPath"&cr after tScript
put " put databaseConnect(tDBPath) into gDBConnectionID" &cr after tScript
put "end onPreOpenStack" after tScript
set the script of tTheNewStack to tScript
end CreateNewDBStack