Forums > Javascript

Read value from a toggle

Oct 14 2012 | 11:48 am

How can i read the value (selected/unselected) from a toggle? i don’t see that an attribute for that to use with getattr.

Oct 14 2012 | 12:38 pm

the best I could do is to enable Parameter Mode Enable, thereby allowing one to set the toggle’s initial state (0 or 1). This can then be "read" using [sel 0 1]. I guess you could also use [loadmess] to achieve the same thing. This probably won’t help if you need to read the toggle state dynamically….


Oct 14 2012 | 12:48 pm

….second best I could do:

— Pasted Max Patch, click to expand. —


Oct 14 2012 | 1:20 pm

Reading it dynamically is indeed what i want to do (with js). I don’t get it, i seem to be able to read every parameter i see in the inspector, but the most important one (its value, or selected-state) isn’t accessible?

Oct 14 2012 | 2:13 pm

and third ugly-hacky-non_js way:

-- Pasted Max Patch, click to expand. --

and a little nicer pattr-also_non_js:

-- Pasted Max Patch, click to expand. --

Oct 14 2012 | 2:32 pm

I think this thread answers your question:


Oct 15 2012 | 3:14 am

I think both n00b_meister and Andrzej are over thinking the non-js just a little bit ;)
unless I am way off base, this is probably the easiest way of doing it… non-js, that is.
Feel free to hit me over the head if I’m wrong!


-- Pasted Max Patch, click to expand. --

Oct 15 2012 | 10:30 am

-- Pasted Max Patch, click to expand. --

Oct 15 2012 | 10:52 am

This was indeed what i was looking for: obj.getvalueof()


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

Forums > Javascript