scrolloffset(array,get) problem

Jul 20, 2009 at 4:31pm

scrolloffset(array,get) problem

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]);
}
#44800
Jul 20, 2009 at 7:11pm

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;
#161256
Jul 20, 2009 at 7:31pm

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]);

}
#161257
Jul 21, 2009 at 3:50pm

hello chris and maxers,

sorry i don’t have the solution, and i don’t understand why ??!

if i do (as you do):

toto = this.patcher.scrolloffset ;

toto[0] is always 0 and toto[1] is always 1 even when i offset the patcher.

Anybody knows ?

nicolas.

#161258
Jul 29, 2009 at 4:13pm

Hello maxers,

in 2004, David Zicarelli wrote in the forum :

So — the words offset and origin as patcher properties do not work. In
the next version these property names will be changed to scrolloffset
and scrollorigin. However, I think what you really want is the bpatcher
offset, which is not what the “offset” property of a Patcher was
supposed to have returned in any case. The patcher offset (soon to be
the scrolloffset) refers to the scrollbar offset of a patcher window,
not the bpatcher’s offset within a box where the patcher is displayed.
There is currently no way to access the bpatcher offset as a property
since it is specific to a bpatcher (but perhaps there will someday if
the bpatcher gets attributes).

according to : i tried several stuff, but always wrong. Is there a bug ?

thanks,

nicolas.

#161259
Jul 29, 2009 at 6:32pm

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

#161260
Jan 16, 2012 at 3:50am

it still doesn’t work ):

#161261
Oct 11, 2012 at 8:35pm

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)?

#161262
Jan 14, 2013 at 3:12pm

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

inlets = 1;

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

#161263

You must be logged in to reply to this topic.