Forums > Javascript

js equivalent to thispatcher messages

April 21, 2006 | 7:47 pm

Hi, I’m changing a patch from regular messages to js and I can’t figure out
how to replace thispatcher messages. The docs state that you can send
messages to the js Patcher object just as you would with the [thispatcher]
object, but I don’t think this goes for window flags. Some of them I found
in the Wind object messages and attributes, but not all.

these are the flags/messages from my original patch
*
*"window flags nofloat, window notitle, window flags nogrow, window flags
noclose, window flags nozoom, window exec"->[thispatcher]

and then

"front"-> thispatcher.

I have this in js:

var hwnd = this.patcher.parentpatcher.wind;

hwnd.hastitlebar=0;
hwnd.hasgrow=0;
hwnd.haszoom=0;
hwnd.bringtofront();

I’m positive that hwnd is correct, because I use hwnd.location to resize the
window and it works, but bringtofront() doesn’t do anything.
Also I can’t figure out the equivalent to the float and close flags. I want
the window to display without anything BUT the thin border, and afaik I need
to set nofloat for that. Or is it possible to set the flags using the
Patcher object? I’m a little lost here. Thanks for any help.

Thijs

**



jml
October 29, 2006 | 2:09 am

similarly to max scripting, you have to also include the execute message to the patcher after changing its state, so something like the following will work:

//////////////////////////////

var wind = this.patcher.wind;

function grow(){
var a = arguments[0];
wind.hasgrow = a;
wind.exec;
}

//////////////////////////////


November 2, 2006 | 4:52 pm

On 10/29/06, jLubow wrote:
>
>
> similarly to max scripting, you have to also include the execute message
> to the patcher after changing its state, so something like the following
> will work:
>
> //////////////////////////////
>
> var wind = this.patcher.wind;
>
> function grow(){
> var a = arguments[0];
> wind.hasgrow = a;
> wind.exec;
> }
>
> //////////////////////////////
>
>
thanks! You know you’re responding to a message that’s over 6 months old
right? ;-) afaik I let it rest, but I still remember were I want to use it.
I guess you meant to write wind.exec(); in the last line…

cheers, -thijs



jml
November 2, 2006 | 10:43 pm

the older the better ;)

actually, window.exec() isn’t actually a func, but a method…
so while max will accept this notation, it complains about it.
window.exec is the proper usage, AFAIK.

jl


November 3, 2006 | 11:08 am

that’s incredibly strange… how can a method not be a function??
that sounds like an arcane logic problem. isn’t a function of an
object by definition a method of that object?

On Nov 2, 2006, at 10:43 PM, jLubow wrote:

>
> the older the better ;)
>
> actually, window.exec() isn’t actually a func, but a method…
> so while max will accept this notation, it complains about it.
> window.exec is the proper usage, AFAIK.
>
> jl


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