03-16-2017 03:29 AM
Marc, I have attached the modified code. It is still not working properly. Am I configure it wrongly?
03-16-2017 07:31 AM
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.
05-10-2017 03:36 AM
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
05-23-2022 06:35 PM
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".
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.
Hope this helps.