I need to set the Toggle state (on/off), is it possible ?
The reason for my request is the following : the toggle on state starts a treatment. When the treatment ends, if the toggle is always on, the treatment will be restarted one more time if the user does somethings on the Human UI window.
The solution I imagine is to set the toggle to Off when the treatment is finished.
As an easy solution you can use the logical operator AND to restart if the toogle is True and also another value (the state you want to consider, maybe another toogle to set if restart) is True. This way if the toogle is True but the state is false, the AND will give false.
You mean to set the state of the Toggle with the CreateToggle component plugged into input with the Value Listener current value ? It doesn’t work because it creates a cyclic execution in the definition. So, we need a “Set Toggle” component, as there are “Set Label Contents”, “Set Check Box”, …)
I also need this because I want a toggle to be systematically “Off” when the window that contains it is opened.
As it stands, the toggle “remembers” it’s previous state, and if it was “On” when the windows was last closed, it will also be “on” when the window is re-opened.
The Metahopper “Expire” component works, but somehow, the timing isn’t right : When the window opens, the toggle is still “On”, and switches “Off” afterwards, which defeats my purpose because the toggle still sends a “True” value downstream which is what I need to avoid…
Raising this post from the dead rather than starting something new. I understand there still isn’t a Set Toggle, and may not be one, which is okay, I respect Andrew’s time and the work he has done so far.
However, is there another work around? It is possible to utilize a Set Checkbox for toggles, which is essentially using the same Boolean output? It doesn’t work of course, but could we use a Python or C# script between to adapt it?