newobject() arguments for bpatcher
I have to admit, I’m having some trouble figuring out the order of arguments for newobject() from looking at the documentation. First I tried this:
numbpatchers = a;
thebpatchers[k] = this.patcher.newdefault(0, 0, "bpatcher");
thebpatchers[k].rect(k*100, 0, (k+1)*100, this.patcher.wind.size);
But neither seem to work as desired. All I want to do is set the rectangle (actually in presentation, but I’m just trying to get it running at this point) and file. I’m sure this is very simple, I just can’t seem to find many examples of scripts that create new objects other than the one in the tutorial that uses newdefault() and doesn’t set any parameters.
Is FloatingButtons.maxpat in your search path? If not you will have to use the full file path to get this to work. The second method where you call replace() works for me.
It is in the search path. The second method loads the file, but the rectangle is not correct. It should create 100 pixel wide vertical strips that are the same height as the window. As noted, I’d also like it to set the presentation rectangle if you could point me to that function.
Please correct me if I’m wrong, but it seems I should be able to create the object and set all of these parameters by just calling newobject(). But how do I find out the correct argument order for bpatcher, or any object for that matter?
Did you ever get this figured out?
digging that actually (I mean now)
This works fine for me:
offset = this.patcher.box.rect;
object = this.patcher.parentpatcher.newdefault(offset,offset,
"@patching_rect", (offset+5), offset, "128", "128",
"@presentation_rect", (offset+5), offset, "128", "128",
reminds me overriding of class in other worlds ;-)
thanks for your post, it helps me right now :)
creates a patcher without name, but no complains in max window
it sounds very weird :-/
I meant, it doesn’t create a bpatcher and I don’t know why ?!
I just quit, reload. it is ok.