Forums > Javascript

moving bpatcher with js in presentation mode

June 28, 2010 | 9:30 am

I can’t seem to find the way to move / resize bpatcher in presentation mode. It has writable .rect property, but writing to it changes its patching place/size. May be I grab the wrong object though. My approach is to give scripting name to a bpatcher then find it with this.patcher.getnamed("name"). I know that with [thispatcher] I can send messages either to patch inside bpatcher or to bpatcher’s "box" and I could move it then (by talking to the box). Is there a way to achieve the same in javascript?


June 28, 2010 | 9:49 am

ah, found it:

this.patcher.script("sendbox",varname,"presentation_rect",x,y,w,h);

June 28, 2010 | 11:12 pm

I’m fairly sure you can use presentation "size" and "position" (or "pos") from within javascript if you only want to change one or the other and not specify both, if it helps.

lh


July 7, 2010 | 4:52 pm

that’s right:

this.patcher.script("sendbox",varname,"presentation_size",w,h);
this.patcher.script("sendbox",varname,"presentation_pos",x,y);

both work. What I was looking for (and found) was the way to address [bpatcher]‘s box instead of its contained patch.


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