11-11-2014 11:35 PM
Hi,
I put a string control in my front panel. but I found the text I typed in unable to transfer to my program at real time. for example, I type 5 in the string box and push a button to transfer the character to some where. next time I type 6 in this control again and push buttong again. however, this time the control still trasfer 5 to my program. To solve the bug, I have to mark "Update value while typing" from control property. Why? the control don't update its value automatically?
Solved! Go to Solution.
11-12-2014 12:42 AM
Everything about this, other than being solved by using "update value while typing", suggests a dataflow issue. For instance, having the control outside of a loop and trying to read its (changed) value insde the loop.
Please post your code and any steps needed to recreate the issue.
11-12-2014 02:00 AM
Hi Z,
Here is VI. I use this VI to input data to a database. I put some string control in front panel and use an Event struct. When user click "Ok" button, the data from controls should be fetched and inject into a cluster. But sometimes, the value from control is the character I typed las time.
11-12-2014 02:29 AM
Ah. Ok. I've had this happen to me a few other times and I believe what is going on is that the OK button mouse down event is firing before the string is updating after losing focus. I've fixed this in the past by forcing a focus change to any other control before trying to read the string (in this case). Here, I changed your code to be "OK value change" and I added a blank case for "OK mouse down". I believe the order the events are processed is mouse down?, mouse down, and then value change so by having the case before your write to DB executes it gives the string time/reason to update.
This feels cludgy and probably wrong, but it works. Hopefully someone will be along shortly to provide a better way.
In the process of looking into this I took the liberty of condensing your block diagram. I also created a version that didn't try to write to DB or automatically exit. I attached both versions.
11-12-2014 06:53 AM
This thread describes a similar issue:
11-12-2014 07:55 PM
Hi,
Thanks so much. Your solution is fine. I also explore the thread listed in above response. It seems this bug was fixed in Labview 2014. Share this information for you all.