Read value from a toggle

Oct 14, 2012 at 11:48am

Read value from a toggle

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

#64759
Oct 14, 2012 at 12:38pm

Hi
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….

Brendan

#233545
Oct 14, 2012 at 12:48pm

….second best I could do:

– Pasted Max Patch, click to expand. –

Brendan

#233546
Oct 14, 2012 at 1:20pm

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?

#233547
Oct 14, 2012 at 2:13pm

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. –
#233548
Oct 14, 2012 at 2:32pm

I think this thread answers your question:

obj.getvalueof()

http://cycling74.com/forums/topic.php?id=25125

#233549
Oct 15, 2012 at 3:14am

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!

M

– Pasted Max Patch, click to expand. –
#233550
Oct 15, 2012 at 10:30am
– Pasted Max Patch, click to expand. –
#233551
Oct 15, 2012 at 10:52am

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

Thanks!

#233552

You must be logged in to reply to this topic.