Can a bpatcher get scroll position of its parent?

Simon Dawes's icon

Hi all,

I have several bpatchers stacked horizontally in a parent patcher.

When I scroll far enough in any direction that a bpatcher isn't visible onscreen, I'd like to halt its UI functions.

In a way, this would emulate the [active] object, but based on bpatcher’s position relative to my computer screen.

I've spent a lot of time trying to get JS inside bpatcher to work.

The best I can do is get it to return "0 1", no matter how far I've scrolled the parent patch in any direction.

Below is the code I'm currently using.

(Though, I've been through a stupid amount of iterations, so this is just another failed attempt and will inevitably change; including it more as proof of some failed attempts before asking forum for help.)

Are any JS wizards able to shed some light?

Cheers – Dawes

function bang() {
    var parent = this.patcher.parentpatcher;
    if (parent) {
        var scrolloffset = parent.scrolloffset;
        outlet(0, scrolloffset);
    }
}

Source Audio's icon

if I remember correctly this.patcher.scrolloffset is not working

Simon Dawes's icon

Ah, this rings a bell!

I learned this fact a few months ago, and had just forgotten.

Thanks for the reminder.

Don't suppose there's any other way to reach the goal?

Source Audio's icon

you can manually offset your main patch, without scrolling with scrollbars.

that can be used to deactivate hidden bpatchers.