Page 1 of 1

Drag and drop to stack

Posted: Tue Mar 17, 2015 4:30 am
by Cyberqat
I'm trying to write an IDE tool that I can drag and drop onto a stack.
The drag is working but putting a dropEnter in the stack's script doesnt seem to allow a drop.

code below:

Image being dragged:

Code: Select all

on dragStart
   set the dragData["text"] to empty
   set the dragImage to the id of me
   set the allowableDragActions to "copy"
   set the dragAction to "copy"
   pass dragStart
end dragStart
Stack I am trying to drop on

Code: Select all

on dragEnter
    set the dragAction to "copy"
    pass dragEnter
end dragEnter

Re: Drag and drop to stack

Posted: Tue Mar 17, 2015 7:52 am
by Simon
Are these 2 different stacks?
Not a substack of a main stack?

There may have to be a "on mouseEnter" on the second stack.

Simon

Re: Drag and drop to stack

Posted: Tue Mar 17, 2015 9:49 am
by bn
If you are planning on something akin the revPalette for tools then I "stole" some code from from stack "revTools" card 1 "on mouseDown"

http://livecodeshare.runrev.com/stack/757/GridDrawer

it is from stack

The behavior part is my addition.

Kind regards

Bernd

Re: Drag and drop to stack

Posted: Tue Mar 17, 2015 6:00 pm
by Cyberqat
Yes this is inter-stack.

Thanks for the code example, I'l look it over!

Re: Drag and drop to stack

Posted: Sun Mar 22, 2015 10:42 pm
by Cyberqat
Wow thats some complex code.

I wish they had made this a bit simpler. It seeme like there aught to be an easier standard solution for making components...

Re: Drag and drop to stack

Posted: Tue Mar 24, 2015 12:47 am
by Cyberqat
I found this, its a much simpler and easier to work with example.

https://app.box.com/shared/o8zaqami56aaqpbg76g8

Re: Drag and drop to stack

Posted: Tue Mar 24, 2015 7:00 am
by bn
Hi Cybersquat,

that is Peter Haworth's example stack that I did not know. It is a lot easier than what Livecode uses in the IDE.

your link is the same stack as the one in Livcodeshare:

http://livecodeshare.runrev.com/stack/614/DragExample

Thanks for posting this.

Kind regards
Bernd

Re: Drag and drop to stack

Posted: Fri Jun 19, 2020 12:52 pm
by Simon Knight
Hi,

I have used Peter's stack as the basis of an update. It may be found attached to this post https://forums.livecode.com/viewtopic.p ... 52#p193252