08-03-2017 05:56 PM
Dear,
I have an issue putting variable in the event loop.
As shown in the attached VI, when I change the input and then click the middle button, the output does not change. It only change only after I click twice.
How can I use mouse down event and only click once to make output as same as input?
Yes, by using mouse up it works but I do not want to use mouse up event.
Thank you so much for your help.
I have moved my previous discussion from here:
https://forums.ni.com/t5/LabVIEW/Event-structure-Problem-with-data-transfer/m-p/3670646#M1031683
Solved! Go to Solution.
08-03-2017 06:05 PM
It looks like you are working with an old version of LabVIEW. I got it to work, look at the following, and see if you can understand. Hopefully the down conversion worked.
mcduff
08-03-2017 06:34 PM
JiaLiGenmark wrote: How can I use mouse down event and only click once
I cannot look at you VI now, but normally, you should use the Value Change event instead of the mouse down.
08-03-2017 06:37 PM
@crossrulz
That is what I did with the VI I uploaded, however, I left the mouse down functionality in there if there was something else they wanted to do. (It could be deleted) I am unclear as to what the intended functionality of the VI is.
mcduff
08-03-2017 06:47 PM
Dear,
Thank you for your very fast response and very considerable down conversion.
I can open it up.
However, I found you moved the indicator-"output" from inside of the "mouse down event" to the outside of the event. I need to do some calculation using the number from the input after the mouse down event is triggered. That is why I put the indicator inside the "mouse down event". Is there a way to update the value inside the "mouse down event" with only one click?
Thank you so much for your time.
08-03-2017 06:53 PM
Dear,
Thank you for your reply. Yes, I need the mouse down event.
I simplified the problem from a larger VI.
Best,
08-03-2017 07:58 PM
There is no reason to have the control write to a local variable of itself outside the loop.
I can tell you need to click twice, sometimes. If you change the input control, and click out of it, then do the mouse down on the boolean, the output will update from the input. The reason is that when you click out, that allows the number you entered in to be actually "ENTERED" into the control. (Of course hitting enter works as well.)
If you change the number, but the cursor is still in the control in edit mode, the control hasn't technically changed. So the first click on the boolean does two things, one, fire a mouse down event, two, enter the new value into the control. But the mouse down event happens first, so the execution of that even case still uses the "old" value. The new value doesn't register into the control until after that. That is why the second boolean click is needed so that the mouse event will fire again and thus use the new value.
I think you'd be better off if you change the mouse down to a mouse up event. The mouse down elsewhere allows the control to update. And the mouse up distinctly happens after that so the event case will then use the NEW value just entered into the control.
So, do you really still need a MOUSE DOWN event?
08-03-2017 10:50 PM
Again, I am not sure what you are trying to accomplish.
However, I found you moved the indicator-"output" from inside of the "mouse down event" to the outside of the event. I need to do some calculation using the number from the input after the mouse down event is triggered.
The value is on the wire, that is, the shift register. You can do operations on the wire since it has the value. The output is just an indicator that displays the value, it is not the variable, the wire is.
Maybe you can try to give a different example for your desired functionality.
mcduff
08-03-2017 10:58 PM
Dear,
Thank you for your reply.
"You can do operations on the wire since it has the value."
Yes, it has the value. But it's the old value, not the value I just input with the cursor blinking.
Best,
08-03-2017 11:05 PM
Dear,
Thank you for your explanation. It's very detail.
Yes, Mouse down is necessary. The reason I do not use mouse up is because of concerning of customer experience. That's the major reason I make post today. There's always delay of firing if we do mouse up.
Best,