[Sharing] Draggable patches
I put together this example as a way to extend a patch's functionality. It helps in several ways:
--When you drag a patch using the title bar, you can get interruptions in many processes that are happening. Especially try clicking and holding a title bar while (say) a MIDI sequence is playing, you can get a very noticeable pause. This method of dragging eliminates this.
--If you turn the title bar off, you can set the patch background alpha to semi-transparent. This allows you to make floating control panels and still see what's underneath, but without a dragging function, you can't move the window. So this gives you both, and the transparency can look pretty slick IMHO :)
--If you click and hold the "Close" button on a normal patch, you'll get a complete freeze of processes. Using a "close" message to [pcontrol] to close the patch will eliminate this too. (It's not in this patch, but thought it would be good to mention along the lines of eliminating pauses, and it's a means to close a patch without a title bar/close box.)
I *think* the mouse movement subpatch is as streamlined as possible to create the dragging functionality. It does require you to set an overall patch size for the one you're dragging, though probably there's a way around that too.
The patch uses a [ubutton] under everything, so in Edit mode you'll probably click it a lot by accident. Just put it into the background and lock the background.
Enjoy!
that's quite fun and interesting, but i got the problem that wherever i click on the patch, it recalculates its location immediately in a nearly random manner... then you must hold the click and drag it with a strangely placed mouse pointer (sometime outside the patch area). maybe a problem of screen size, yours beeing different than mine, and thus causing different results in calculations somewhere ? Don't you have this problem too ?
anyway nicely done and thanks for sharing :)
hmm, maybe the "mode" messages for in the mouse subpatch aren't being initialized with the loadbang properly. Sounds like that might be the case, where it's getting global instead of patch coordinates or vice-versa. I don't get any window jumping using it, but I did while I was figuring out the mousestate and the subtraction parts...
anyway, the idea is there, so maybe it'll work itself out with some tweaks :)
Indeed ! it's actually kind of silly from me, because i pasted the patch from the forum, and didn't realize there was a loadbang, so began to try it wihtout initializing the patch ;)
when i reopen it, there's no problem. Thanks and grats :)