01-03-2019 10:15 AM
Hi everyone,
Here is my penny for your thought,
I have a GUI with an event structure to handle the users' clic.
On this GUI I place a toggle switch and I would like to be able to handle separately the change from high/low and low/high. Though I can't find where to handle the change of state in two separate cases.
Not sure if I am being clear ^^
01-03-2019 10:20 AM
You use the Value Changed event and use a Case Structure inside to do something different depending on the "New Value".
01-03-2019 10:23 AM
If you are using a value change event then you can configure the event to return the new value.
That value can be used to drive an case structure where if the new value is TRUE then the transition should be false to true etc.
Ben
01-05-2019 02:20 PM - edited 01-05-2019 02:31 PM
On your GUI is a Boolean Toggle switch, call it "Toggle". You have an Event Structure, with a Toggle (Value Changed) Event. Inside the Event Structure (for that Event), you can do one of the following:
Do you understand how the "mechanical actions" of Boolean Controls work? If not, look it up, or build a little test VI and watch it work, noting when the value changes from False to True, from True to False, and under what conditions it changes itself back to the default value (which, for Booleans, is False).
Bob Schor
01-07-2019 07:58 AM
Must resist the urge to mention the corner case where Bob's assumptions don't hold.......
Dang it.
01-07-2019 08:00 AM
Must resist the urge to correct myself.....
Dang it.
01-07-2019 08:04 AM
Must resist the urge to make yet another obscure and hugely niche remark
Dang it.
Three strikes and I'm out.
01-07-2019 08:18 AM
On the topic of mechanical action...
I have pretty much switched over to "Switch when Pressed" and put the terminal in the event case that handles that value change. I then use a property node inside the event to set it false again. This allow me to insert a very short delay just prior to resetting it. The delay makes it obvious the button was pushed. Without the delay I have had a customer report "the button is not working" only to find out that the button was working but it ws reset so fast they did not see the state change.
Ben
01-07-2019 08:32 AM
@Ben wrote:
On the topic of mechanical action...
I have pretty much switched over to "Switch when Pressed" and put the terminal in the event case that handles that value change. I then use a property node inside the event to set it false again. Ben
I would say the "Switch When Released" would be preferable and is comparable to the typical to way Windows typically handles buttons. The "When Released" allows you to slide off the button and not have the button actuated if you change your mind mid-press.
01-07-2019 09:07 AM
@Intaris wrote:
Must resist the urge to make yet another obscure and hugely niche remark
SpoilerDefault value of a boolean is not per definition "False". It's only default "False" by default (makes complete sense, right). You CAN set the default of a boolean control to be "True" upon which case, the "resetting" of the switch becomes reversed for latching actions. i.e. when you choose "False" and then read the terminal on the BD, it will go back to "True" as opposed to the opposite way around. This is a great obfuscation which can lead to some head scratching when people encounter it for the first time.Dang it.
Three strikes and I'm out.
Hahaha. That's a beauty. Have never seen that one in the wild before.