scrolloffset(array,get) problem

crconover's icon

Hi,
I'm trying to write a js object that will return the scroll offset of a patch when banged. It seems pretty straight forward to use the scrolloffset(array,get) method to return these values, but I am receiving an error: ReferenceError: get is not defined, line 8

I've looked in the reference and it was not entirely clear on this method.

Any help would be great. My code is listed below.
Thanks in advance,
Chris

inlets= 1;
outlets= 2;

p= this.patcher;
var offset;

function bang()
{
    p.scrolloffset(offset, get);
    outlet(0,offset[0]);
    outlet(1,offset[1]);
}

Luke Hall's icon

Scrolloffset is a property of the patcher object rather than a function. Try replacing the first line in your "bang" function with the line below and it shouldn't cause an error.

lh

offset = this.patcher.scrolloffset;

crconover's icon

Thanks for your help, although it still is not outputting the scroll offset of the window... and I'm not sure why. Here is the current code. Any thoughts?

Thanks,
Chris

inlets= 1;
outlets= 2;

p= this.patcher;
var offset;

function bang()
{
    offset = this.patcher.scrolloffset;
    outlet(0,offset[0]);
    outlet(1,offset[1]);

}

crconover's icon

Hi Nicolas,

The scrolloffset is what we want, but it is currently not working. Apparently a lot of the JS stuff needs to be re-written and Cycling 74 hasn't gotten around to it. I alerted them of the problem so hopefully it will be fixed soon.

I too am waiting on these fixes to finish up a program I've been working on it.

Best,
Chris

11OLSEN's icon

it still doesn't work ):

juan's icon

I'm on Max6.0.7 and I'm also getting 0 and 1 on the scrollbaroffset property. It seems to be broken still. Anybody found a workaround to get scroll position on a patcher (or bpatcher)?

lasmiveni's icon

My problem was the opposite,
I found this solution, accessing to the wind properties:

inlets = 1;

function bang()
{
this.patcher.wind.scrollto (X, Y);
}

Oni Shogun's icon

Over a decade on and the property is still bogus ^^

post(this.patcher.scrolloffset,'\n')
// always returns 0

I have tried all manner of other properties and name variations perhaps under the hood, though to no avail.

¿¿¿ Chances of implementation ???