Coming from a Flash and Director background I was a bit dismayed to see no straightforward way of allowing interface objects to be dragged around in Max. Then, as I got more familiar with the program I realized that with transparent buttons, scripting, and mousestate, this could be done. It’s not as simple as something like “draggable 1” (which would be such a great addition to Max objects!), but it’s doable. Plus, after getting the basics down, automation and presets can be saved for the position of objects (positions are not saved with the patcher, you need to store / retrieve them with presets or colls).
I have a patch with three draggable objects, included below. I use bringtofront and sendtoback with the transparent buttons to make dragging “active / inactive”. What I’m wondering is whether anyone else has come up with a simpler or alternative way of doing this, and if so, I’d love to see it. As stated in the comments, using bpatcher would eventually be a better way of doing this, as the encapsulation and hiding would be more robust. (I didn’t want to do a bpatcher to post to the forum though, needing separate files and all.)
Question 1: Is there a way to tell when the mouse is over an object? LCD outputs mouse position over its rectangle, but it also will hide the object. I wish there was a “within bounds” flag (and position information) included in the transparent button. I want to be able to highlight the object before clicking it.
Question 2: How might one use a mask with a transparent button, so that non-rectangular objects can be dragged effectively?
Thanks! Hope this is useful...