Draggable UI objects and a couple questions

    Dec 08 2006 | 11:53 pm
    Hello all,
    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...

    • Dec 09 2006 | 11:27 am
      Since no one has answered this in 12 hours I'll give it my best shot.
      Back-story and ranting The current set of max UI objects were born from a standpoint of just giving the program the information it needs to run some sort of algorithm. You can hack up some pretty nice stuff, but its not what its made for. Thats not to say that an amazing UI is not possible inside max. If you want something more professional, you can step into javascript,java, C, or open GL. or even plain LCD
      I feel I can definitively say that Cycling hears the call that the max application itself should have more of the amenities of a normal user experience. Unfortunately keeping everything cross-platform seems to hold that back quite a bit.
      After spending a week on three dialog boxes, Lord knows that I'm ready for nib file integration into max....
      Your Questions
      right now there are two main ways to get hover information 1 maxobjects.com... "hover" 2 write a javascript that archives all the UI objects you need and compares their coordinates against the mouse coordinates
      currently rectangular buttons are the norm. somewhere, in the deep dark depths of some elves computer, a copy of max exists that supports alpha channels in the UI. Weather it will see the light of day, is anyones guess.
      to regulars /I'm trying to be diplomatic -matt
    • Dec 09 2006 | 12:29 pm
      Unfortionatly, I am at a loss to be able to help with the scripting thing. + maybe instead of bring to front/back to move between draggable and non dragable you could just place them at the bottom corner of the objects. Up to you though.
      However, the main thing that hit me from your message is that you are a flash user moving over into max. So why not just built your gorgeous interface in flash and use flash server to communicate with max? Its not my area of expertise, but I have a freind who specialises in communication between max and other programs, and has done this extensively.
      Hope this gives you food for thought anyways T
    • Dec 09 2006 | 9:19 pm
      I wish to God I'd researched and found out about Max before trying to build audio mixers and graphics visualizers in Flash (and mainly Director). Coding is interesting to a degree, but for these projects Max wins by orders of magnitude because of its included objects. There are *some* things the others do better (animation? else?), so maybe the Flash-Max communication server would be good to use. As far as actually using those programs much, though, I found Max and haven't looked back! The UI can in fact be pretty gorgrous in Max with some planning and effort, so that's what I intend to do.
      Max's ability to manage, store, automate, interface with MIDI, play and edit movies, and audio process is so amazing...I'm really trying to get my students to discover this---as I hear them say "I want to have buttons to click and play sounds" and they do it in Flash... fine, but that's as far as they'll get, I imagine... not too much else you can do there without some serious delving. Been there, don't wanna go back!
      Thanks for the input---and who is this mystical friend who does the Max / other program communication? Any link or other information about it would be great.
    • Dec 09 2006 | 11:30 pm
      Thanks for the response. I wasn't able to find "hover" at maxobjects.com. However, I think if I really want the functionality I'll just keep a coll of the current positions and sizes (here, the rectangles are a plus!) -- that way I can monitor the mousestate. It'll be a bit of a trick, but with some doing, it could be used for any object. Highlighting the objects one drags over isn't necessary but could be a nice effect.
      I do hope there's alpha functionality eventually. Until then I'm still damn happy with this amazing software. Wish there was an "rollover" flag for that transparent button though. Ah well... maybe it's time to learn some C or javascript and develop custom objects. Sounds like a real challenge...
      Thanks again, your response was helpful.
    • Dec 10 2006 | 9:42 pm
      Seejay James wrote: > Ah well... maybe it's time to learn some C or javascript and develop > custom objects. Sounds like a real challenge...
      Definitely the JSUI should be worth to look into. And of course LCD.
      Another observation regarding your example. It works nice, but makes the dragable UI objects useless. What is the idea behind it. Max itself has a switch built in between dragable and usable by locking/unlocking a patch. But I just have no idea what this should be good for in a locked patch...
      -- Stefan Tiedje------------x------- --_____-----------|-------------- --(_|_ ----|-----|-----()------- -- _|_)----|-----()-------------- ----------()--------www.ccmix.com
    • Dec 10 2006 | 10:19 pm
      The idea is that users can drag objects of the UI around without needing a full version of Max---to be able to do this in the runtime or in a collective/app where's there's no edit mode available. If you unclick "draggable" the objects then (should!) work with usual functionality (the transparent buttons get sent to the back so are then unclickable, so the objects return to normal functionality).
      It's a little strange maybe to have users be able to drag each object. That's why I think for a polished version, the controls would be in bpatcher "clumps" or clusters of related ones, then those windows (which might include, say, a delay module with several elements, or a filtergraph and number-box settings) could be dragged around and their locations saved as presets. Of course, presets of nice-looking interface layouts could be pre-saved anyway, but it just seemed like dragging was an intuitive way of customizing the UI. It might be nice for users to have more control this way, which would be in addition to numerous customization controls for window sizes and positions, etc.
      Quite possibly I would also include two versions of any patch--one with somewhat larger objects on it, for higher-resolution monitors or for more easy readability. Having user control over these elements would be kinda cool too, I'll just see how it goes. It might relieve some of the Max "clutter" of too-many-number-boxes etc. to have multiple versions with different numbers of objects, differently-sized objects, different layouts, etc. For example, versions for 1024 x 768 versus 1600 x 1200 could be substantially different patches and might do well with some level of customization.