Forums > MaxMSP

Get size of this bpatcher?

May 10, 2014 | 9:45 am

If you have an abstraction being displayed in a bpatcher, is it possible for the abstraction to get the size of the bpatcher?



Lee
May 14, 2014 | 2:50 am

Hi, not sure how to do this in normal Max, but the following js will give you the bpatcher size if called from within:

inlets = 1
outlets = 1

function getsize() {
if ( this.patcher.box )
outlet( 0, this.patcher.box.rect );
}


May 14, 2014 | 3:09 am

Amazing, thanks Lee.

I will call this code on patcher load, to resize the bpatcher contents based on the size of the bpatcher.

Is there a way to have this code execute automatically after each time the bpatcher is resized?



Lee
May 14, 2014 | 3:47 am

No, don’t think so – if you need to get updated, best thing to do is set up a metro object to fire the message into the js every x ms and respond to changes in the result


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