have a look at the ardour online example “strip types”
if the id of a switch is “test1” and you set its value to 11, you can catch its value with @{test1} in another widget (e.g. in a value property via #{} , or via JS {{}} ) this is possible in all properties which are dynamic.
Hi abstrus, thanks for the response. That was the first thing I’ve tried but in this particular case, I’m trying to catch the value of four different switches independently.
If I set the value of the input to @{test1} @{test2} @{test3} @{test4} the result will be four different values at the same time ie. 1, 2, 3, 4
I need the result to be one switch at a time. Example: If I press switch1 value 4, the input widget will retrieve the number “4” alone. If I press switch2 value 7, the input widget will retrieve the number “7” alone, etc etc. Instead of retrieving all four numbers at the same time.
yes of course, what you are referring to is often called “radio button” (think so…).
Made a quick test.
just use a switch, fill in the values in the corresponding field.
if the id of the switch is “switch_1” you can catch this value via @{switch_1}.
Usefull if you use it in a JS{{}} context and trigger there OSC messages, etc…
But there might be other tricky stuff here e.g. when loading at first time-> setting the default value to ‘0’ the input is showing “undefined” (no switch is pressed) -> would have expected a 0 on the input obejct, maybe @jean-emmanuel could jump in here?
(maybe it is of interest when no button is pressed -> value of 0)
I’m using one input widget to catch four different switches values and send them as MIDI data. I need the input widget output to be one value at a time. What you are suggesting won’t work for me unfortunately.
But the reset idea is great! Or an option to reset the switch whenever another widget is used. I tried to use Jean’s @{switch_example} invalid value method but in my particular case it’s causing errors because I’m outputting MIDI data.
Thanks a lot @jean-emmanuel ! I was able to go from 14 input widgets down to two! I now have one input widget listening to all switches and a second input widget sending midi.
I've tried to use the @{switch_x} invalid value method, it does for example reset switch_1 when I use switch_2 but it gives me the following error:
ERROR: MIDI: Traceback (most recent call last):
File "E:\open-stage-control\resources\app\server\python\midi.py", line 214, in send_midi(*msg)
File "E:\open-stage-control\resources\app\server\python\midi.py", line 176, in send_midi args = [int(round(x)) for x in args]
File "E:\open-stage-control\resources\app\server\python\midi.py", line 176, in args = [int(round(x)) for x in args]
TypeError : type str doesn't define _ round _ method
Since I'm sending midi, it's expecting only midi data, instead of "invalid value". Is there another way to reset a switch (unselected) in this particular case?