creating new subpatchers in a special way

    May 07 2007 | 1:38 pm
    As promised, I'm now dipping my toes into javascript. Almost starting to get a hang on it. Now, I'd like to use js to create a new patcher with specific window size and flags at creation time, and keep it from opening. I know how to manipulate the window after creation, but I'd like to set all the properties as it is born.
    The Max example patch below illustrates what I'm trying to achieve - except I shouldn't need the thispatcher and the messages when using js.
    Any ideas about these tasks are welcome.
    Max Patcher
    In Max, select New From Clipboard.

    • May 10 2007 | 10:47 am
      Im only just getting to grips with MAX, but Ive started with Javascript first because Im familiar with it as a language. So Ive tried, but dont seem to be able to do what you're asking for, but maybe what Ive found will be of help.
      So far:
      A patcher created by new.Patcher opens automatically. A patcher created by this.patcher.newdefault opens automatically. A patcher created by this.patcher.newobject opens automatically.
      I havent managed to discover any reference to parameters for these function calls which might create a hidden Patcher.
      The only way I [i]can[/i] manage to create a hidden patcher, is by creating a pcontrol object in javascript, and sending it the message ("shroud", "patchTemplate") where patchTemplate is a potentially empty patch stored as a file. However the problem is that the created patcher seems to be created 'anonymously' in that it is [i]not[/i] visible to the js object as an object present in the Patcher. Nor is a Patcher object created within the parent. And since it [i]is[/i] invisible, it cannot be opened...
      However if your hidden patcher [i]never[/i] has to be opened, then this might be an option. You might need to use send/receive to pass data to it, though, since I cant work out a a way of connecting to any inlets or outlets on the 'anonymous' Patcher.
      Hope that helps, some.
    • May 10 2007 | 12:58 pm
      Thanks for the input.
      Although I'd like to know if and how it is possible to do all the things I asked for, I really need only one of two things: either prevent the window from opening, or set the correct size and flags at creation time.
      The best solution would be to be able to delay the opening, but if that's impossible, do anyone have any suggestions for the other option, i.e. define size and flags?