LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Magic or Logic problem?

Hey All,
I came across this strange behaviour in this while loop.
There is a while loop and inside this there is a OK button to get inside the case structure which displays "OK button pressed", and a CANCEL button to stop the loop.
Now I have used the mechanical action as "switch until released".
Now the problem is that when I press OK button it displays dialog box saying "OK button pressed" twice! One after the other.

So, is it LOGIC or MAGIC?

Although I have solved this problem by using mechanical action as "Switch when pressed" and using it's local variable in case structure to turn it OFF.

----------------------------------------------------------------------------------
I have still not got what I love.....
0 Kudos
Message 1 of 6
(2,892 Views)

Hi Halemani,

If you change it to "latch when released" or "latched when pressed" you should be fine. The latch state will allow the switch to be read only one time in the after it is pressed.

What is happening when it is "Switch until released" is that the switch is read as being pressed, the dialog box pops up which captures the mouse events, you press the ok button and release, then the dialog goes away but the system still sees the OK button as being depressed.  That state is getting read before it figures out that the button is no longer pressed.

I think it is a race condition between labview and the GUI.....

Best regards



Message Edited by tartan5 on 04-12-2008 07:43 AM
0 Kudos
Message 2 of 6
(2,865 Views)
But the thing is I can't use latch options. Since I am using a local variable to this button(ok). Labview does not allow me to do it. I think the only solution is use 'switch when pressed' and then reset it back. What do you say?
----------------------------------------------------------------------------------
I have still not got what I love.....
0 Kudos
Message 3 of 6
(2,812 Views)
Instead, why dont you use an event structure?.. That will solve your confusion of Local variables, or it will eleiminate the possibility of using local variables.
0 Kudos
Message 4 of 6
(2,796 Views)
Hi Halemani,

"what do you say?" - Use a different algorithm!Smiley Very Happy

See attachment on how to use an event structure...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(2,792 Views)
But, I don't want to use event case in my loop. Anyway guys I have solved the problem. Thanks for the help. Smiley Wink
----------------------------------------------------------------------------------
I have still not got what I love.....
0 Kudos
Message 6 of 6
(2,788 Views)