Get position of a bpatcher on load

Aug 28, 2011 at 11:31am

Get position of a bpatcher on load

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

#58663
Aug 28, 2011 at 11:56pm

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]);
}
#210939
Aug 29, 2011 at 2:08am

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

– Pasted Max Patch, click to expand. –
#210940

You must be logged in to reply to this topic.