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

Now that you know the reason, you can figure out how to work around it.

One possibility.  detect if the "new" value is the same as the "old" value.  You can store the value in a shift register so you know what it was. If it is, then you know it didn't change.  Execute a case structure after the event structure that will check the local variable again and execute it.

 

Actually, don't do anything in the event case.  Just wire out a True to a case structure after it so that it executes what you current have in the event case.  That will allow the mouse down event to finish the update of the control.  There is a small wait in there to allow the CPU time to finish the updating of the control before it is read.

0 Kudos
Message 11 of 16
(1,898 Views)

@JiaLiGenmark wrote:

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,


Every operating system I know of uses mouse UP for a button click.  Because the event won't fire until mouse UP, you have a chance to move off of the control before finishing the click.  This cancels the command.  May I enquire as to why the user needs this "instantaneous" input?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 12 of 16
(1,886 Views)
Solution
Accepted by JiaLiGenmark

Here is my mod.

 

1. Changed the boolean to a control and set it to Latch When Pressed.  This way, the value will change when the mouse is pressed down on the control.

2. Changed to event to be Value Changed and moved the terminal for the boolean into the even case.  This will allow the boolean to reset itself.

3. Got rid of the local variables and just moved the Input terminal into the event case to write directly to the output.

4. Allowed the VI to stop when you attempt to close the front panel.  The panel closing is being discarded so it will not actually close.



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 13 of 16
(1,882 Views)

@billko wrote:

Every operating system I know of uses mouse UP for a button click.  Because the event won't fire until mouse UP, you have a chance to move off of the control before finishing the click.  This cancels the command.  May I enquire as to why the user needs this "instantaneous" input?



Sure. In application when time is sensitive.

In most applications such as word, excel, office or browser, user has plenty time to think.

 

Labview is more used for controlling hardware, sometime we need to fire a command instantly. Let me make an example, if you play shooting video game if the fire event delays after you press the mouse button,  you may never hit the moving target.

0 Kudos
Message 14 of 16
(1,878 Views)

@JiaLiGenmark wrote:

@billko wrote:

Every operating system I know of uses mouse UP for a button click.  Because the event won't fire until mouse UP, you have a chance to move off of the control before finishing the click.  This cancels the command.  May I enquire as to why the user needs this "instantaneous" input?



Sure. In application when time is sensitive.

In most applications such as word, excel, office or browser, user has plenty time to think.

 

Labview is more used for controlling hardware, sometime we need to fire a command instantly. Let me make an example, if you play shooting video game if the fire event delays after you press the mouse button,  you may never hit the moving target.


That's exactly what I had imagined for your case.  Sorry, that question was more for me than for you.  I appreciate your reply and your confirmation of the reasoning behind your decision.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 15 of 16
(1,871 Views)

@crossrulz wrote:

Here is my mod.

 

1. Changed the boolean to a control and set it to Latch When Pressed.  This way, the value will change when the mouse is pressed down on the control.

2. Changed to event to be Value Changed and moved the terminal for the boolean into the even case.  This will allow the boolean to reset itself.

3. Got rid of the local variables and just moved the Input terminal into the event case to write directly to the output.

4. Allowed the VI to stop when you attempt to close the front panel.  The panel closing is being discarded so it will not actually close.



Thank you. Super satisfied.

The key is value change of the button.

0 Kudos
Message 16 of 16
(1,864 Views)