Implementing dragging functionality - how to use jdrag_add()

Luigi Castelli's icon

Hi,

I would like to implement some dragging functionality in my UI external and I am looking at the drag.h API.
I have carefully read the Drag'n'Drop chapter in the MaxSDK and studied the pictmeter~ example. It all makes sense. Simple enough...

Now, the pictmeter~ example only shows the usage of jdrag_box_add() and how to send one message ("read") without any arguments.

The MaxSDK states:
"For more control over the process, and for adding more than one message, jdrag_add() can be used. If you add more than one message, the user can use the option key to specify the desired action. By default, the first one you add is used. If there are two actions, the option key will cause the second one to be picked. If there are more than two, a pop-up menu appears with descriptions of the actions (as passed to jdrag_add()), and the selected action is used."

This is great news. As a matter of fact, in the scenario I am dealing with it is imperative that I provide arguments and it is highly desirable to be able to send more than one message. So I need to use jdrag_add() which is prototyped as:

// dg     the jdrag object
// rcv    the jbox which will have a message called when the dragged thing is released
// msg    the message name that will be sent to the box when the dragged thing is released
// desc   a description to be displayed in a contextual menu for the drop action
// arg    user data to be passed to the drag function (for example, the t_symbol* of the message to call in the case of jdrag_box_add())
void jdrag_add(t_object *dg, t_object *rcv, t_symbol *msg, char *desc, void *arg);

Despite the explanatory comments I can't figure out how to use jdrag_add() and accomplish what I want.
Can C74 post a brief example on how to setup jdrag_add() to send multiple messages and have the pop-up menu appear?

Thanks in advance.

- Luigi