jackscl Posted January 24, 2019 Report Share Posted January 24, 2019 It's a very easy event case. The problem is that the String to write (hex display) terminal passes the old value rather than the new value to the String out on my boss's computer when I clicked COM Write Button.But the problem never happens on my computer.Our computers' environment both are win7 and LabVIEW2014-Chinese. Is there anybody can explicate this phenomenon? Thanks. Quote Link to comment
Benoit Posted January 24, 2019 Report Share Posted January 24, 2019 Please post your actual VI. This will allow us to see if there is race condition or other problem. Thanks Benoit Quote Link to comment
jackscl Posted January 24, 2019 Author Report Share Posted January 24, 2019 1 hour ago, Benoit said: Please post your actual VI. This will allow us to see if there is race condition or other problem. Thanks Benoit Maybe the mouse down event and the button's mechanical action is the reason? I like using value change event in my code. It's a Retired colleague's program,I delete the subVIs which the company doesn't want show. Test.vi Quote Link to comment
Benoit Posted January 24, 2019 Report Share Posted January 24, 2019 Here is the problem. When displaying in a Hex format, the update value while typing cannot be activated. Since the value is updated only when you click somewhere else on the front panel, if the first click is on the button COM Write, the value is updated after the Event mouse down is fired. Benoit 1 Quote Link to comment
jackscl Posted January 24, 2019 Author Report Share Posted January 24, 2019 1 hour ago, Benoit said: Here is the problem. When displaying in a Hex format, the update value while typing cannot be activated. Since the value is updated only when you click somewhere else on the front panel, if the first click is on the button COM Write, the value is updated after the Event mouse down is fired. Benoit Thank you very much. I find if i use value change event,it will be pass current value.(I usually use it).I will search the different between value change and mouse down. Quote Link to comment
Rolf Kalbermatter Posted January 24, 2019 Report Share Posted January 24, 2019 (edited) The difference is that Mouse Down is generated first for the control that the user clicks on, then if that processes successfully the Key Focus is changed to the new control which commits the value to the control that had previously the Key Focus, which results in the Value Changed event for that control. So at the time the Mouse Down event is processed, the Value Change event for the previous control has not been processed yet. When you use the Value Change event for the button instead, it is guaranteed that the Value Change event for the string that is a result of loosing the Key Focus for that control, has been already processed. Edited January 24, 2019 by Rolf Kalbermatter Quote Link to comment
jackscl Posted January 25, 2019 Author Report Share Posted January 25, 2019 12 hours ago, Rolf Kalbermatter said: The difference is that Mouse Down is generated first for the control that the user clicks on, then if that processes successfully the Key Focus is changed to the new control which commits the value to the control that had previously the Key Focus, which results in the Value Changed event for that control. So at the time the Mouse Down event is processed, the Value Change event for the previous control has not been processed yet. When you use the Value Change event for the button instead, it is guaranteed that the Value Change event for the string that is a result of loosing the Key Focus for that control, has been already processed. Thank you for your explanation.I get it.I will convince my boss. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.