Jump to content

Terminals can't pass current value in event case


jackscl

Recommended Posts

image.png.c9dd5b3c7373fe72ef8a2a7ff01ba9c9.png 

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.

Link to comment
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

Link to comment

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

  • Like 1
Link to comment
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.

Link to comment

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 by Rolf Kalbermatter
Link to comment
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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.