05-12-2010 11:22 AM
I made a simple dialog that has a field for entering a value and an OK and CANCEL button.
I pass the field out to the caller if you click the OK button.
If you use the mouse, all is well.
I tied the RETURN key to the OK button.
Suppose the field contains 1.234.
If you type in the field "2.468", and then hit RETURN, I would expect the RETURN key would first enter the new value into the field and THEN register the event.
But no. What comes out is OK = TRUE and mG = 1.234 (the old value).
It is not registering the new value at all.
Am I missing something?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
Solved! Go to Solution.
05-12-2010 12:02 PM
It seems to work as you expected in LV2009.
What if you have a separate Stop button in its own event case? I realize this may not meet the needs of your program, but it could be useful in tracking what is happening. Do you get the desired number one iteration later, as though the numeric control was read before the event case was entered?
Lynn
05-12-2010 12:56 PM
Well, the behavior is that if I click anywhere outside the field (even in empty space on the panel), the field gets updated correctly, even if it hit RETURN.
Suppose the field is sitting at 1.
If I type 2-RETURN, then it does the wrong sequence: it triggers the event, reads the field (with the old value of 1) and THEN updates the field.
If I bring up the dialog again, it shows the 2 left over from last time. If I type 3-RETURN, it reports out a 2, but leaves the field 3 for next time.
I can make a workaround, but I was wondering if this was explained by something other than an LV bug.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-12-2010 01:10 PM
Ah, ...
I see that also. I was using a knob and changing it with the mouse so the numerical entry ended on mouse up.
So the issue is that Return is doing two different things to two different controls. First it is terminating entry into the numeric control. Second it is toggling the boolean. I suspect that it cannot do both with a single press of the key. I am not sure where such a thing would be documented.
Lynn
05-12-2010 01:54 PM
Well, to me it's clear that ending editing (and thus entering the new value into the field) is the FIRST thing that should happen when the control loses focus, and THEN the OK button should be triggered.
But that's not what's happening.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-12-2010 02:01 PM
Right. I had the order wrong.
Lynn
05-12-2010 02:07 PM
05-12-2010 02:12 PM
BINGO!
I've never noticed that option!
For the last few years, my projects have had NO key assignments (per users' requests), so I haven't used them.
I don't know when this was introduced, nor why you would want it OFF, but when I turn it ON, things work as I expect.
Thanks!
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-12-2010 03:23 PM