Extracting the state of a toggle in JavaScript

    Mar 05 2010 | 2:11 pm
    Is there a message that can be sent to a Javascript-created toggle to learn its current state (which may have been altered by the user)?
    TiA, Eric

    • Mar 05 2010 | 3:29 pm
      Assuming that you have a toggle somewhere in the patcher named "yoyo". You can use the pattr system to get it's value using getvalueof.
      function bang() { var toggle = this.patcher.getnamed("yoyo"); outlet(0, toggle.getvalueof()); }
    • Mar 05 2010 | 5:22 pm
      Outstanding. Thanks EJ!
    • Jul 26 2011 | 3:11 am
      the javascript documentation could be extended / improved a little bit more..
      lets see what version 6 will bring to us!
      any references / articles in this matter are always welcome!
      happy patching guys!
    • Jul 26 2011 | 3:12 am
      duplicated, sorry
    • Aug 01 2011 | 2:48 am
      super cool, that was the little and important piece i was needing for my javascript toggle sequencer, i should post sources very soon ( :
      tks guys!
    • Aug 01 2011 | 2:53 am
      the current version is attached.
      yet super simple, build a grid of toggles than outputs bang when the playhead passes by a toggle set to ON.
      need to improve it a bit to be really useful, but the main concept and code is pretty much there.
      any feedbacks, suggestions, improvements, are more than welcome.