onclick.local, ondrag.local, onresize.local: what are they for ?

Roald Baudoux's icon

Hello,

In the jsui help patch, there's the 2d vector control example.

One can see lines of code using the onresize.local, onclick.local and ondrag.local variables.

First I do not understand when those lines are executed because they are outside any function (see shortened code below).

Second, what are they for ?

Thank you in advance.

Roald Baudoux

function onresize(w,h)
{
...
}
onresize.local = 1; //private

function onclick(x,y)
{
...
}
onclick.local = 1; //private

function ondrag(x,y)
{
...
}
ondrag.local = 1; //private

pdelges's icon

Salut Roald,

setting the local property of a function to 1 will make it inacessible from outside the js instance, i.e. from Max patches.

In your example, you cannot send the message onclick(66,666) to the js.

Setting values don't need to be done within a function, I'm sure you do things like: inlets = 1; in your codes.

p

Roald Baudoux's icon

OK, the answer is in "Max JS Tutorial 4: Designing User Interfaces in JavaScript".

Roald Baudoux's icon

Salut Patrick,

I discovered your answer after having posted mine !

Sure code can be put outside functions but it's a bit strange to see it there...