Extracting the state of a toggle in JavaScript
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
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());
}
Outstanding. Thanks EJ!
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!
duplicated, sorry
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!
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.
peace