LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Click once instead of twice to update the output in mouse down event

Solved!
Go to solution

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

0 Kudos
Message 1 of 16
(4,003 Views)

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

0 Kudos
Message 2 of 16
(3,996 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 16
(3,975 Views)

@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

0 Kudos
Message 4 of 16
(3,973 Views)

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.

 

     

0 Kudos
Message 5 of 16
(3,971 Views)

Dear,

        Thank you for your reply. Yes, I need the mouse down event.

        I simplified the problem from a larger VI.

 

Best,

 

0 Kudos
Message 6 of 16
(3,968 Views)

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?

 

0 Kudos
Message 7 of 16
(3,949 Views)

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

0 Kudos
Message 8 of 16
(3,937 Views)

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,

 

0 Kudos
Message 9 of 16
(3,935 Views)

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,

0 Kudos
Message 10 of 16
(3,934 Views)