getting presentation coordinates of object
I would like to be able to get the coordinates of an object, knowing the object's scripting name. I am currently using this message in Javascript, which works fine when not in presentation mode:
this.patcher.getnamed(the_object_scripting_name).rect
However what I really want to do is to get the presentation coordinates of the object, when in presentation mode. How do I do that?
BTW, if there's a non-Javascript way to do this, I'm all ears.
Thanks!
Figured it out on my own - the coordinates delivered by the Javascript change to the presentation coords when in presentation mode. Still, interested if there's a non-Javascript way to do it...
pattr can bind to many attributes, I know patching_rect is one of them, not sure about presentation_rect. check pattr for the right syntax ::
binding gives some interesting possibilities for UI layout, user customization, presets etc. of the positions of objects, not just windows.
Seejay, thanks very much -- I had overlooked thinking about the pattr family for this. That said, I have never tried to use pattr to get/set some of these "common box attributes", and after mucking about for a while I still can't seem to do it. Can you give an example of how you can query a pattr for its bound-to object's patching_rect for example?
Thank...
pattr my_pattr_name @bindto my_object_scripting_name::patching_rect
Not all the attributes can be bound, I don't think, but probably most can. You could keep track of whatever info you want about your objects, and it updates as you edit, kind of the reverse of what we generally do---we use the mouse to move and resize, or send messages/use the Inspector to change attributes of objects. Now we're getting the info from the "other side", so we can mess with it or store it if we want... make different object layouts, appearance presets, restrict edit values to a range, fun stuff.
Wow, that's very cool - I never knew that pattr could do that! But now another question - all of my pattr bindings are taken care of by an autopattr object in my patches. Do you know how I can specify a specific attribute of my objects to bind to using an autopattr? Or am I really going to have to bind all my UI objects manually using this pattr syntax?
Thanks again!
autopattr directly binds to the object (value) itself. If you need to bind to specific attribute of an object, then pattr@bindto theobject::somegreatattribtue is required.
Not sure if this is especially helpful for you, as you can't really bind to the object to make a preset in the same way that you can using pattr, but you can use pattrstorage/autopattr to send get and set attributes of bound objects:
Emmanuel and Ben - thanks very much.
Ben - that example is *very* helpful to me!! The documentation would benefit to get this level of detail in there at some point... (or perhaps I've just missed it?)
Dan
Wow, nice tricks are being shown here!
Randomly reading topics on the forum has its benefits!
you can take it a bit further, it's nice to be able to get/set all the attributes from one place (pattrstorage). You could use [route] on the values that come out and are sent back in, and keep everything hidden away in a subpatch. And the same [pattrstorage] which remembers the attributes of certain numbers can also remember the values of other numbers, like the ones that set those attributes:
Or you can do that in this way...in presentation mode, whit different ways to store your presets...
brilliant stuff.... this needs to be in doc!
Wow I have been looking through the forums, and this is so close to what I am trying to do! Amazing! I have 58 current objects in a presentation mode that all have individual scripting names. I have a document that has the following text seen below, but I got it via the inspector by hand for all 58. With the idea of using two message boxes that will toggle between two different screen layouts. One for a laptop and one for a 27inch screen for a standalone app. Any tips for using patter to take a snapshot of current presentation positions of scripted names and then store them? Or perhaps just save out all the scripted names so I don't have to do this by hand, we have seven apps I am looking to use this functionality. So streamlining it would be amazing!
script sendbox ch1Gain presentation_position 142 113,
script sendbox ch1text presentation_position 23 178,
script sendbox ch1restext presentation_position 54 177,
script sendbox ch1spoutToggle presentation_position 174 127,
.... (58)