getting presentation coordinates of object

    Feb 21 2010 | 9:22 pm
    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:
    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.

    • Feb 21 2010 | 9:37 pm
      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...
    • Feb 21 2010 | 10:21 pm
      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.
    • Feb 22 2010 | 5:10 pm
      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?
    • Feb 22 2010 | 7:53 pm
      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.
    • Feb 23 2010 | 1:33 am
      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!
    • Feb 23 2010 | 2:17 am
      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.
    • Feb 23 2010 | 7:27 am
      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:
    • Feb 23 2010 | 3:16 pm
      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?)
    • Feb 23 2010 | 4:32 pm
      Wow, nice tricks are being shown here!
      Randomly reading topics on the forum has its benefits!
    • Feb 23 2010 | 6:13 pm
      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:
    • May 15 2013 | 6:56 am
      Or you can do that in this presentation mode, whit different ways to store your presets...
    • May 19 2013 | 9:52 am
      brilliant stuff.... this needs to be in doc!