LabVIEW Idea Exchange

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

The return key should register a value change event on the active and edited control, before toggling any associated button.

Status: Declined
Moved to CAR database as CAR 447743

Scenario:

 

A user has updated the value of a control in a window that has an OK button that will close the window. The controls are in a loop with an even structure. The OK button is set to toggle if the Return-key is pressed, and its change event will stop the loop. The user is happy with the state of every input in the window, including the just entered change, and hits the Return-key to OK the changes. The window closes...and the user later discovers that the last input he made, just prior to hitting the return key, never got registered...Smiley Frustrated

 

The problem is that the Return-key does not trigger a change event for the active control *prior* to toggling the state of the OK-button. So if the OK button happens to stop the execution of the given VI, the last known value of the control that was active prior to the pressing of the return-key is not what the user saw at the time. People who use LabVIEW a lot get so used to this behaviour that they more or less unconciously click somewhere in the window with the mouse, or navigate elsewhere with the tab key to trigger an update, before they hit the return key. Everyone else get cought off guard.

 

Yes, it is possible to program around this problem by making sure that the toggling of the OK button does not stop the loop immediately but allows it to spin one more cycle just to make LabVIEW register the last control entry (or in the case of string controls, by setting it to "update while typing"). Adding such logic should not be necessary in this case though, it should be part of the in-built behaviour.

 

 

 

PS. Every time I run into this issue I feel like I must have overlooked or forgotten something. It cannot be true that this is not already handled automatically(!). I believe this problem was present even without the use of an event structure in some older versions of LabVIEW, or am I just getting senile?Smiley Wink

14 Comments
crossrulz
Knight of NI

Yes, this is an issue.  Ran into it plenty of times.

 

My way of coding around this is to not associate the return key with the ok button.  I make the user tab to the ok button to activate it.  So they tab through each control they may want to set before they can hit the ok button (assuming they are only using the keyboard).  It probably isn't the best solution, but it works.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
AristosQueue (NI)
NI Employee (retired)

This is now reported as CAR 447743.

Darren
Proven Zealot
Status changed to: Declined
Moved to CAR database as CAR 447743
elset191
Active Participant

Maybe I'm missing something here, but I've gotten around this by simply checking "Set to Focus on Toggle" 

 

Focus.png

--
Tim Elsey
Certified LabVIEW Architect
crossrulz
Knight of NI

elset: Nice catch.  That is a simple work around.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Mads
Active Participant

Yes, setting it to focus on toggle will fix the issue as it triggers the otherwise missing change event...I get that as the default behaviour as well now strangely...so perhaps that's just been changed at some point in time.

 

It is not really intuitive that you have to set it up like that, but with the default in place it's OK (so perhaps it will only affect old code where the focus on toggle is not set to true...that's a bit bad, but tolerable).

AristosQueue (NI)
NI Employee (retired)

Hm... I am just guessing, but it seems like you would want the "don't commit" behavior if you had a button tied to the Esc key so that the value doesn't get changed.

 

Mads
Active Participant

That would make sense, yes. We can do this now then by setting the OK-boolena to focus on toggle, and the Esc-boolean to not focus on toggle...

 

The only thing I'm afraid of with this way of solving the original issue is wheter the focus on toggle feature is actually meant to be used for this or not...If it is a solution just by accident (not really targeted towards generating a change event on the edited control prior to a change on the toggled boolean), someone might change it later and break it's positive side-effect.

AristosQueue (NI)
NI Employee (retired)

CAR 447743 should be fixed in the upcoming LV 2014.

Jeff-P
NI Employee (retired)

CAR 447743 discussed in this thread was fixed in  LabVIEW 2014.  For a more complete list of bugs fixed in LabVIEW 2014, check the LabVIEW 2014 Bug Fixes. You can download an evaluation copy of LabVIEW 2014 at http://www.ni.com/trylabview/ or if you have an earlier version of LabVIEW installed and an active SSP subscription, you will be able to download the latest version of LabVIEW through NI Update Service.

 

Regards,

 

Jeff Peacock 

 

Product Support Engineer | LabVIEW R&D | National Instruments | Certified LabVIEW Architect