How do I create an object in a subpatch.

    Feb 18 2014 | 1:24 am
    So I have a main patcher (mainpatch), and in it there is a sub patcher (subpatch). I want to create an object (let's using button for example) inside that subpatch. How do I do that with scripting? To make an object in the mainpatch I have been using: this.patcher.newdefault(200, 200, "button");
    I tried giving the sub patcher a scripting name (subpatchscript) and using: var sub = this.patcher.getnamed('subpatchscript'); sub.newdefault(200, 200, "button"); but that does not do anything. Any suggestions?
    Thank you very much for the help.

    • Feb 18 2014 | 9:44 am
      [thispatcher] is an object to which you send messages that affect the patcher within which it resides. Look over the [thispatcher] help file for examples of scripting.
      This should get you going.
    • Feb 19 2014 | 3:26 am
      Thank you and this is along the right path but I was looking to do this in Javascript. In other words, how do I assign a global variable name to a subpatcher object, and then create an object inside that. Here is what I have so far with the code accompanying
      var x = 0; var sub = this.patcher.getnamed('sub'); function bang(){ this.patcher.newdefault(x, 100, "button"); x += 50; } function makeinsub(){ sub.newdefault(100, 100, "button"); //This does not work } //sub.subpatcher.newdefault(100,100,'button'); //neither does this
    • Feb 20 2014 | 5:33 am
      Doh! Of course. Well.. can't help you there but I can bump the thread. :)
    • Feb 20 2014 | 6:09 am
      You can do something like this:
      sub.subpatcher().newdefault(100, 100, "button")
    • Apr 02 2014 | 1:37 am
      THANK YOU!
    • Jun 18 2014 | 8:34 pm
      sub.subpatcher().newdefault(100, 100, "button")
      THANK YOU!