Drag and drop

hello to all you 4v wizards,

since short i am trial and erroring towards more vvvv knowledge.

i try to build a simple ‘drag and drop’ functionality.

the action i achieved so far is the following:

  1. with pressed mouse button i can drag an object to another position
  2. by releasing the mouse button the object stays at the new cursor position
  3. by clicking the mouse button the object jumps to the current cursor position

the point 3 is what bothers me. the object should only be dragable with the cursor being over it.

i am using one ‘mouse’ node, two ‘switch value output’ nodes, one ‘circle’ node and one ‘render GDI’ node.

maybe someone can point me to the right direction.

use the intersect node to check, whether the mouse is over.

so for interaction with objects at this level its better to go for ex9 then gdi?
i will try the intersect. thanx.

and btw, @guest: you will need the S&H node at one point

thanx oschatz.

i am still not through.

the ‘S+H (ANIMATION)’ node is cool. i achieved a similar output with a ‘TOGEDGE’ node between the ‘leftbutton’ pin of a ‘MOUSE’ node and the ‘switch’ pin of a ‘SWITCH(VALUE OUTPUT)’ node. without the ‘TOGEDGE’ they seem fairly equal in this case.
i will experiment with the ‘S+H’.

the biggest problem seems to be to refeed the object (e.g. ‘ROUNDRECT’) with the new coordinates, but in a way that my simple mouse over detection won’t turn untrue the minute i move the mouse and hold the left mouse button down.

how can i get the f…ing current coordinates of a for e.g. ‘ROUNDRECT’? i think i missed something with the spreads, have to understand them better.

attached my approach.

now it works. the holy ‘FRAMEDELAY’ was a big part of the answer.

i am curious about other approaches without using a loop.

some details are still not perfect. the most disturbing thing is that the object, once selected, centers itself with the cursor position, although it was selected e.g. on a corner.

p.s. vvvv is really cool. its an experimental, creative way to handle numbers and manipulate bits and bytes and it is really fun. thanx.

dundd.jpg (91.5 kB)

Don’t know, if it helps you to achieve what you want but maybe you want to have a look at this: Drag :)