Forums > MaxMSP

Cannot bind subpatcher's pattr to object in main patch

December 12, 2006 | 4:24 pm

Hello,

In order to clean my main patch I want to put all my pattr
objects inside a subpatch. However I cannot manage to bind the
pattr object to any object in the main patch (Max 4.6.2).

The help patch for pattr has an example of a downward binding
but there is no example about upward binding. Should I use an
"up::" message ? Also the following explanation found in the
help patch is not clear: "If nested inside of a patcher,
abstraction, bpatcher or poly~, pattr objects will auto-name
their parent patcher based on the name of their associated
argument/file name or, failing that, based on their object
type (e.g. ‘bpatcher[2]‘)."

The following patch shows this problem (save as "pattr_test")

Of course I could use one autopattr to replace many pattr but
I do not want to save data for all my UI objects or having to
send tens of the "active" message.

So is it possible to achieve this or not?

thank you for helping.

Roald Baudoux

max v2;
#N vpatcher 189 128 789 528;
#P toggle 192 181 15 0;
#P toggle 110 181 15 0;
#P toggle 125 105 15 0;
#P objectname myswitch;
#P window setfont "Sans Serif" 9.;
#N vpatcher 174 272 733 540;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 365 89 61 196617 solution $2;
#P outlet 306 173 15 0;
#P toggle 306 87 15 0;
#P newex 306 117 172 196617 pattr param2 pattr_test::myswitch;
#X prestore 1 0 0;
#P objectname param2;
#P outlet 152 173 15 0;
#P toggle 152 87 15 0;
#P window linecount 0;
#P newex 152 117 135 196617 pattr param1 up::myswitch;
#X prestore 1 0 0;
#P objectname param1;
#P comment 192 89 61 196617 solution $1;
#P fasten 1 0 2 0 157 141 143 141 143 81 157 81;
#P connect 2 0 1 0;
#P connect 1 0 3 0;
#P fasten 4 0 5 0 311 141 297 141 297 81 311 81;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P pop;
#P newobj 110 154 92 196617 p sub;
#P objectname sub;
#P comment 69 59 179 196617 test patch for pattr’s upward binding;
#P comment 143 106 170 196617 < - this object is named "myswitch";
#P window linecount 2;
#P comment 44 221 364 196617 if the pattr link worked ,
either one of these toggle objects should change according to
the "myswitch" object but it doesn’t.;
#P window linecount 1;
#P comment 210 157 134 196617 < - the pattr object is inside;
#P comment 65 37 152 196617 Save this patch as "pattr_test";
#P connect 5 0 7 0;
#P connect 5 1 8 0;
#P pop;


December 12, 2006 | 5:05 pm

I think you want something like

[pattr param1 @bindto parent::myswitch]

I’m pretty sure it’s in the docs somehwhere, can’t remember where though.

hth
Owen

Roald Baudoux wrote:
> Hello,
>
> In order to clean my main patch I want to put all my pattr
> objects inside a subpatch. However I cannot manage to bind the
> pattr object to any object in the main patch (Max 4.6.2).
>
> The help patch for pattr has an example of a downward binding
> but there is no example about upward binding. Should I use an
> "up::" message ?


December 12, 2006 | 7:38 pm

Owen Green wrote :
>
>I think you want something like
>
>[pattr param1 @bindto parent::myswitch]

Indeed, it works perfectly!

Thanks.

Roald Baudoux


December 12, 2006 | 8:42 pm

use the "parent" keyword, e.g. parent::someobject or
parent::parent::someotherobject or
parent::otherpatcher::yetanotherobject

And I just added some text about this to the reference manual
yesterday for an upcoming version! how prescient!

jb

Am 12.12.2006 um 17:24 schrieb Roald Baudoux:

> The help patch for pattr has an example of a downward binding
> but there is no example about upward binding. Should I use an
> "up::" message


Viewing 4 posts - 1 through 4 (of 4 total)