drag and drop restriction

For questions about using Classic.

Post » Fri Aug 05, 2011 7:39 pm

is it possible, when drag and drop object to object can be placed only on some specific places? or if can be places where it cant simply be object droped?
thanks
B
4
S
2
G
1
Posts: 143
Reputation: 1,211

Post » Fri Aug 05, 2011 8:01 pm

[QUOTE=joxer] is it possible, when drag and drop object to object can be placed only on some specific places? or if can be places where it cant simply be object droped?
thanks[/QUOTE]

It is possible, but it will be a little bit tricky.

Lets take a Sprite object with the dragdrop behavior and Sprite2 as recipient.
Someplace (global variable, private variable, ...) you need to keep trace of the original Sprite.X and Sprite.Y
At last you also need a Keyboard & Mouse input object.

In the event sheet:

Event Sprite/DragDrop: Sprite.On drop
Sub Event Mouse: Is mouse over object Sprite2 (inverted) : Position Sprite to original X and Y
That means that you're droping Sprite anywhere else BUT on Sprite2 and then, putting back Sprite where it was, as it was never moved.

This should do the trick.


EDIT: Example: DragDropCancel.capKyatric2011-08-05 20:07:04
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests