From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
TurboPhil

Make "Return/Enter" Key Issue ValueChange Event consistently

Status: Declined

Any idea that has received less than 2 kudos within 2 years after posting will be automatically declined.

Try this:

  • Create a new VI with a numeric control on the FP and an event structure on the BD
  • Add an event case for "ValueChange" on the numeric control
  • Run the VI and click inside the numeric control
  • Press "Return" (or "Enter")

Notice that this does *not* trigger the value change event. However, editing the value and then pressing enter triggers the ValueChange event.

 

Ahh, but you point out "Well, in that case, the value *did* actually change, so that's why the event fired." And you're right.

 

But then try this:

  • Change the value to some arbitrary number, say "1234"
  • Observe that the ValueChange event fires
  • Now, highlight the numeric text and retype the exact same value: "1234", then press enter
  • Behold! This time it triggers a ValueChange event Smiley Frustrated

 

Seems super minor, I know. But I found myself in a situation where I want to trigger an event if a user hits "enter" in a numeric field, regardless of whether the value changed or not (e.g. it should be able to reassert the current value). Yes, the obvious solution is to handle the enter key press separately, but that means when the enter is used to assert a different value, I end up with *two* events.

2 Comments
TurboPhil
Active Participant

I think really what I'm looking for here is a separate event option: Value Assertion. So we could keep the concept of Value Change around, but also have a way to trigger an event if an unchanged value was reasserted. So all ValueChange events would also trigger Value Assertion events, but re-applying the same value would trigger the Assertion event, as wel.

Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 2 kudos within 2 years after posting will be automatically declined.