iPlug2 Forum

Implementing Drag 'n Drop Function

I’m currently building a drag 'n drop modulation framework and was wondering the best approach for this. I’m aware of OnDrop for the IControl class, but don’t know how to implement the rest. When the user drags the cursor from the modulation source to the modulation destination, I’d like to provide some indication (different cursor or something following the cursor) that they are modulating a parameter.

From what I understand, this is my current workflow:

  1. The user drags a tab control, which sends a message to the delegate from UI.

  2. The plugin controls wait for the OnDrop function to be called (assuming the user completes the modulation.

  3. Once the user drops the modulation onto a control, the control sends a message to the UI with the necessary details to store a modulation object in a list.

There are just a few miscellaneous things that I am unsure of:

  • If the user lets go of the mouse during dragging to signify they do not wish to complete the modulation, where is the OnMouseUp going to be called? Should I temporarily create a full-screen, transparent control that will receive the OnMouseUp? And would that interfere with the OnDrop function for the parameter controls?
  • If I change the mouse cursor on the drag from the modulation tab and the user decided to not complete the modulation, what will change the cursor back to the normal state?

Thanks in advance!

Edit: Now I’m guessing that OnDrop is meant for files, so I was trying to use a function meant for something else.

see this gist IPlug2 cables thing - drag n drop example · GitHub