Forums > Javascript

bug with the display inside a subpatcher

October 4, 2006 | 2:19 pm

Hi all !

I have a little bug with Javascript.
I want create objects in an existing subpatcher, but the display is very strange…
Try this:

Save this JS code in "test.js".

inlets = 1;
outlets = 2;
function test_bug()
// find th patcher buggy
while (tt)
if (tt.maxclass == "patcher")
if (tt.subpatcher(0).name == "buggy")
obj1 = tt.subpatcher(0);

// create the object "receive~ buggy" inside the patcher "buggy"

function bang()

And make this patch:

#P button 46 27 46 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N vpatcher 30 89 630 489;
#P pop;
#P newobj 46 105 73 196617 patcher buggy;
#P newex 46 83 52 196617 js test.js;
#P connect 2 0 0 0;
#P window clipboard copycount 3;

Bang, and look inside the patcher buggy …. !
Close, and re-open this…

If I create the subpatcher in JS, I have no problem when I make object inside this.
The mistake seems to be that I create object in a "closed" subpatcher.

October 4, 2006 | 2:51 pm

The only thing missing is your system and MaxMSP version info.

I can reproduce on Windows in 4.6.2 – a blank looking object is created, but it is still the "receive~ buggy" that you scripted, so hopefully this graphical problem won’t effect the result of your scripting operation? Hopefully it should still work ok even if it doesn’t draw right. If you were hoping to script a UI, then I guess that would be another problem, one for which there will be no quick fix.

Thanks for the report.



October 4, 2006 | 2:56 pm

I’m using MAx 4.6.2, in MacOSX 10.4.7

Yes, it’s only a graphical problem.

October 5, 2006 | 8:45 am

On 4 oct. 06, at 19:46, Andrew Pask wrote:

> Here’s a workaround for you, the refresh() method.

the refresh() method is equivalent to the max.refresh(), isn’t?
Anyway, it does work here when the subpatcher is closed: it displays
"receive~ buggy" in the main patch when you open the subpatcher.


PS: 10.4.8, MaxMSP 4.62 on PPC

October 5, 2006 | 10:33 am

The method refresh doesn’t work for me…

// create the object "receive~ buggy" inside the patcher "buggy"

It displays "receive~ buggy" in the main patch, when I open the subpatcher, and in the subpatcher, the object is still empty (just the box).

10.4.7, MaxMSP 4.62 on PPC

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