Forums > MaxMSP

Get position of a bpatcher on load

August 28, 2011 | 11:31 am

Title says it all; how can I get the position of a bpatcher within its parent patcher upon loading?
Banging a ‘window getsize’ message to a thispatcher within the bpatcher doesn’t appear to work, and anyway, this would get the patchers location relative to the screen origin, not the parent patcher’s,
cheers
Roger


August 28, 2011 | 11:56 pm

You can do this with javascript, it looks like you’d need something like the following in a [js] object in the subpatch you have loaded into the [bpatcher]:

function loadbang() {
    loc = this.patcher.box.rect;
    outlet(0,loc[0],loc[1]);
}

August 29, 2011 | 2:08 am

If you want to avoid javascript, you can use pattr and the @bindto attribute:

– Pasted Max Patch, click to expand. –

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