is there a way to send a message from an abstraction to the parent patch? I'd need this to let the abstractino create a subpatch in the parent patch
-
Send a message to the parent patch
-
Can you just add an outlet to the abstraction and send the message through that?
-
I'd prefer not.
anyhow, what is the syntax to do that? -
Add a [outlet] in the abstraction and it'll show up in the parent patch. Maybe I'm not understanding your question fully.
Otherwise you could use a global send/receive to communicate between the parent and abstraction patch:
i.e. in the abstraction add , and in the parent patch [r abstractionToParent]
Finally if you want multiple abstractions and want to address each one individually, add a unique variable as an argument to the abstraction:
i.e [abstractionName 1], then in the abstraction create a send called , and in the parent patch it'll send to
[r abstractionToParent-1] -
The syntax for creating a subpatch should be something like [$1 canvas 0 0 0 0 0;(
The [ and ( symbols indicate that this is a message box, you should not include them in the command. The zeros are coordinates of the subpatch, not really sure what all five of them do, you'll have to experiment a bit. Finally the $1 is the name of the parent patch. Not really sure how to include a name for the subpatch in the command...hope this helps. -
I'd use something like
|obj 0 0 pd my_subpatch(
|to create the subpatch.
What I want to do is the abstraction to create a subpatch in the parent patch, but without passing any argument to the abstraction, and without even the need for the parent patch to have a name.
is this possible? -
Anything is possible
-
Thanks, I had already got to this point. But as you can see, you actually use the name of the parent patch - which is called pd-parent.pd - , and thus if you call [abstraction] from a patch that is not called parent.pd , this wouldn't work . Furthermore, shoud you have more than one patch called parent.pd , this would create subpatch in each of them, which I don't want.
I'm looking for something that just identifies the parent patch, whatever it may be -
If you're on Pd-extended 0.43, you can use [iemguts/sendcanvas].