Hey,
I can use variables in pd. Got it working using the send object. But when I put in a canvas the variable object it does not seem to recognize it.
Any ideas? Is the canvas already a variable?
Using $0- variables on canvases?
Hey,
I can use variables in pd. Got it working using the send object. But when I put in a canvas the variable object it does not seem to recognize it.
Any ideas? Is the canvas already a variable?
@raynovich Take a look at Pd/doc/5.reference/my_canvas-help.pd.
It is just a simple gui to use as a label or a coloured background to highlight part of your patch.
Its position, colour etc. can be controlled with messages like other guis (by send/receive in the properties window) but it doesn't "do" anything unless you drag it around in edit mode. When you do that it can send its position in the window...... so you could use it as an xy pad instead of [mousestate].
David.
@whale-av
I am getting decent at using canvases. I think I am asking a different type of question.
For instance,
I can do
|5 (
|
|s $0-x|
Which will deliver 5 to just this version of the patch if I do this:
|r $0-x|
|
would receive the 5.
So, with canvas, you can set a receive variable, but I want to use $0-x if possible.
Does that make more sense?
This doers not seem to work and recognize the variable.
@raynovich It does work:
@raynovich The label has to be a symbol....... so that is why when you send float 5 to the label it will not work. The same is true for other GUI's.
You need to turn the "5" into a symbol....... and [makefilename] will do the conversion...
cnv_label.pd
David.
Ah, so: this does not work, I think:
|; $0-x label blah(
But you can still do it that way. Will try it. Thank you.
I did not even think of sending information to canvases this other way. Either way works. Right? Well those two variables are different sends, but if one uses the same variable is there a preferred way to do this? Trying to think of which way is better.
@raynovich Dollar variables work differently in objects and messages.
In objects you can use $0, $1 and so on. $0 is the individual number of the patch or abstraction. $1 and so on are the creation arguments of an abstraction.
In messages you can use $1, $2 and so on. They become the members of the incoming list.
So you can combine the two approaches:
But as you can see, just using [s $0-something] is simpler.
@raynovich said:
Ah, so: this does not work, I think:
|; $0-x label blah(
But you can still do it that way. Will try it. Thank you.
As @ingox says....... $ variables as arguments in objects are not the same as $ variables in messages....... to completely understand that you should read this.........https://forum.pdpatchrepo.info/topic/9774/pure-data-noob/4...... (just read the text below the screenshot).
To get the value of $0 for the patch into the message address in a direct [;( message you need to do this.....
[bang(
|
[$0] "an object"
|
[; $1-x label blah( "$1 takes the value arriving from the [$0] object"
That will work.....
But to make it more user friendly the [$0] can be packed into a list and the label can then be changed by any incoming symbol......
proof.pd
David.
Oops! Looks like something went wrong!