LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting freshly edited value of Numeric control

Solved!
Go to solution
Highlighted

I and my clients are dealing with an awkwardness which has been present in LabVIEW for years. The user types into a numeric field. Then the user, quite naturally, clicks a button. It seems that in LabVIEW's view the data entry into the text field has not been "finished" and my program sees the PREVIOUS value of the field. This can be dealt with if the user:
1. Presses Tab or Enter to complete data entry in the text field
2. Clicks the button a second time.

 

Both of these are quite nonintuitive and my users are getting tripped up.

 

I played around with this and discovered that for a STRING control you can pick the menu item, "Update value while typing" and then it does what I want. But for a NUMERIC control I find no such option.

 

What's the right way to deal with this? Is there a way that I can get the current, freshly edited contents of a numeric field immediately? Or do I have to turn all my numeric controls into string controls with type conversion, to keep my users happy?

 

0 Kudos
Message 1 of 5
(426 Views)
Highlighted

Using a string and update while typing is one way to get around this issue of value changes.  Another is mentioned here:

 

https://forums.ni.com/t5/LabVIEW/Numeric-Value-Change-while-typing/td-p/3708159

 

Which basically reads the string representation of the numeric control which can then be converted to a number.  It does kinda suck in these situations and I would have expected someone had made an idea of this but I couldn't find one.

0 Kudos
Message 2 of 5
(390 Views)
Highlighted
Solution
Accepted by topic author Joymaker

How are you handling the button press?  It works just fine for me with a Value Change event case.  I think you will run into issues if you use the Mouse Down event instead (the value of the numeric is not committed until after the mouse down event).


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
0 Kudos
Message 3 of 5
(381 Views)
Highlighted

@crossrulz wrote:

How are you handling the button press?  It works just fine for me with a Value Change event case.  I think you will run into issues if you use the Mouse Down event instead (the value of the numeric is not committed until after the mouse down event).


I wonder if this was fixed in newer versions of LabVIEW, because I can't get it to break like it did. 

 

I've seen this where a boolean is set to toggle on a press like return (properties of the control) then have an event that is triggered when the boolean has a value change.  The boolean value change will take place before the numeric value change does, because the numeric control doesn't lose focus.  So the value read from the numeric terminal will be the previous one.  But now that I'm trying to reproduce it in 2018 I can't.

0 Kudos
Message 4 of 5
(376 Views)
Highlighted

@Hooovahh wrote:

I wonder if this was fixed in newer versions of LabVIEW, because I can't get it to break like it did.


I initially was having the same thought and I remember it getting fixed sometime.  Don't ask me to even take a guess as to when.


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
0 Kudos
Message 5 of 5
(367 Views)