bug with the display inside a subpatcher
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
tt=this.patcher.firstobject;
while (tt)
{
if (tt.maxclass == "patcher")
{
if (tt.subpatcher(0).name == "buggy")
{
obj1 = tt.subpatcher(0);
}
}
tt=tt.nextobject;
}
// create the object "receive~ buggy" inside the patcher "buggy"
obj1.newdefault(20,20,"receive~","buggy");
}
function bang()
{
test_bug();
}
And make this patch:
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.
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.
Cheers
Andrew
Sorry...
I'm using MAx 4.6.2, in MacOSX 10.4.7
Yes, it's only a graphical problem.
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.
ej
PS: 10.4.8, MaxMSP 4.62 on PPC
The method refresh doesn't work for me...
[...]
// create the object "receive~ buggy" inside the patcher "buggy"
obj1.newdefault(20,20,"receive~","buggy");
obj1.refresh();
[...]
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