06-30-2014 01:36 PM
Hello,
I have a toggle switch that I sometimes disable (grey out and disabled) when a user shouldn't be able to use the switch. However, I'm looking to return the toggle switch to a default position when it is disabled such that when I enable the toggle switch it isn't in the last state the user left it in.
Scenario: A toggle switch to turn on a motor. The user turns on the motor via the toggle switch. The user enters a new operating mode where this motor can't be run so the toggle switch is disabled and greyed out to prevent the user from accidently turning on this motor. The user enters the first operating mode, since the user last left the toggle switch in the on position it will still be in the on position and the motor turns on. I don't want this to happen as the user might not want to have the motor turned on when re-enetering the first operating mode.
Thank you.
P.s. If my explenation is difficult to follow, please post and I will try to clarify my intent
06-30-2014 01:43 PM
06-30-2014 01:44 PM
You can use a property node to enable the button back in your final state ( assuming you are using a statemachine model).
06-30-2014 01:51 PM - edited 06-30-2014 01:51 PM
I recommend with the same property node which you are using to disable it to also set the value property to FALSE.
06-30-2014 02:09 PM
Crossrulz - I am not sure if I'm implementing your suggestion correctly. But if I wire a 'False' logic to the 'Value' property than the toggle switch will always return to false no matter if the switch is enabled or disabled. Unlike your example, I have logic going into my 'Disabled' property node which will select either 'disabled and grayed out' or 'enabled' depending which operating mode the user is in.
06-30-2014 02:11 PM
P@Anand - I am trying to not have the toggle switch behave like a momentary start button. I want it to stay in the 'Motor On' position when someone toggles it and visa versa. Thank you for the suggestion though.
06-30-2014 02:17 PM
@DougHallman wrote:
Crossrulz - I am not sure if I'm implementing your suggestion correctly. But if I wire a 'False' logic to the 'Value' property than the toggle switch will always return to false no matter if the switch is enabled or disabled. Unlike your example, I have logic going into my 'Disabled' property node which will select either 'disabled and grayed out' or 'enabled' depending which operating mode the user is in.
In that case, I would use a Case Structure based on the Disable property value that is being set. If set to Disable and Gray Out, set the value with a local variable. Default to do nothing.
06-30-2014 02:18 PM
07-01-2014 01:18 AM
In that case, I would use a Case Structure based on the Disable property value that is being set. If set to Disable and Gray Out, set the value with a local variable. Default to do nothing.
Also you can have a case where you use an invoke node to "reinitialize it to default".