LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Button does not pop up

I have this button press event  little code.  When the user presses the button the button does not pop back  and remains pressed. Moreover, I get from time to time  (after I pressed the button once )  it appears the button generates the event as if it was pressed  again after the  first time press even though the user did not touch it.  I have attached the code. Please let me know if I did something wrong. I have set up the button as "Latch then pressed"
0 Kudos
Message 1 of 9
(3,798 Views)

Place the button inside the Event case.  And change the mechanical action to Latch When Released.

RayR

Message 2 of 9
(3,791 Views)
Thanks Ray. Why it did not work when the button was outside?
0 Kudos
Message 3 of 9
(3,785 Views)
A latch action boolean stays TRUE until it is read by the code. Since your terminal is outside the while loop, it will get read once at program start and then never again.
 
Message 4 of 9
(3,777 Views)
Thanks a lot.
0 Kudos
Message 5 of 9
(3,769 Views)
I have one more question about my code.  Is it possible for me to force the user to load only files with specific extensions? For example the code above allows to load the user any filed like .xls or .txt. But I won't restrict user's choice only to one specific extension. Is it possible to implement? Thanks.

0 Kudos
Message 6 of 9
(3,763 Views)
On a sidenote, you should maybe do a few tutorials and look the the examples that ship with LabVIEW.
 
You are still stuck in text programming mode, using terminals as a poor substitute for variables and read and write to them via value properties. First of all, this is very expensive. Second, you introduce race conditions.
 
The "experiment scenario" belongs in a shift register (or feedback node), eliminating all the value properties.
 
Let's have a look at a potential race condition:
 
In this image, there is no 100% guarantee that (1) gets written before (2), because there is no direct data dependency. In the worsk case, (2) gets written first and you end up with the settings from (1) after the case completes. You can force execution order by wiring the error cluster between the two nodes as shown with the green line. In any case, the two writes occur nearly at the same time, so you should be able to delete the first write, since these values are very short lived and the final value comes from position (2).
 
Anyway, place the scenario inside a shift register and connect the indicator to it directly.
 
Always remember that LabVIEW does not necessarily operates left to right. Execution order is determined exclusively by dataflow and if there is no data depdendency between two nodes, they can execute in any order.
 


Message Edited by altenbach on 06-20-2008 05:21 PM

Message Edited by altenbach on 06-20-2008 05:25 PM
Message 7 of 9
(3,762 Views)


RSibagatullin wrote:
I have one more question about my code.  Is it possible for me to force the user to load only files with specific extensions? For example the code above allows to load the user any filed like .xls or .txt. But I won't restrict user's choice only to one specific extension. Is it possible to implement? Thanks.

Use a file dialog (from the advanced file functions palette)  and define a pattern (e.g. *.txt). Wire the path output from the file dialog to your read function.
0 Kudos
Message 8 of 9
(3,758 Views)
Thanks for you thorough response altenbach .


Message Edited by RSibagatullin on 06-20-2008 07:49 PM
0 Kudos
Message 9 of 9
(3,749 Views)