LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Flush Event Queue Function with static events

Marc, I have attached the modified code. It is still not working properly. Am I configure it wrongly?

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
Download All
0 Kudos
Message 11 of 14
(1,630 Views)

It all depends on what you are trying to achieve. However, based on the scenario you mentioned above, you put the wait-flush event sequence in the wrong event.

 

When you modify the string and then directly click on the OK button, you generate 2 events: the "Change string value" and the "Change OK button value" by one click. The events are generated very closely in time, in that order; string first, button second. If I understand correctly, you want to flush the OK button event so you have to put the flush events (with the wait) in the string event.

 

I have attached the modified VI here. It works for me with a wait value of 200 ms but not with 100 ms (it might depend on the computer). I don't know why a wait is required.

Marc Dubois
Message 12 of 14
(1,620 Views)

Instead of flushing unhandled OK button event in String event wasting additional 200ms of time try to ignore it just at the beginning of next call. If you add  timeout event case with the zero initial value you can assume that every event handled before it is the unhandled event from previous call. In timeout case change the timeout to expected value (-1). If necessary I could provide a code snippet.

JPękala

Message 13 of 14
(1,498 Views)

Hi;

 

I just deal with same problem. 

 

On a simulated even structure I created a event that send thru a for loop 10 events of value change to "Cancel button" which ones finish the VI.

Then, If I call that VI externally again, there will be 9 value changes to the "Cancel button" event in the queue, so in this case the VI will close immediately, same as yours.

 

I just used the Flush event queue inside the event in which I want to ignore the queue events and that's all.

 

The next is the event in which I generate (intentionally) a queue of 10 events with the "Cancel button".

 

MarcoDelgado_0-1653348798375.png

And the next is the event for the "Cancel button". See the Flush event queue inside, with the reference of the button connected.

Every time I generate the 10 queues, next time I call the VI, it shows 9 events in queue discarded.

MarcoDelgado_2-1653348928085.png

 

MarcoDelgado_1-1653348865698.png

 

 

Hope this helps.

0 Kudos
Message 14 of 14
(803 Views)