01-03-2013 04:37 PM
Hi,
I am trying to write a program where, I have a while loop running at the beginning to make the program wait for me to click a Go button.
I have an event structure at a latter part of my program, where the event is linked to the "mouse move" on a graph window.
Now the program works fine if you click on the go button avoiding the graph window. But it hangs if you move your mouse through the graph window. I can see the problem why it might be happening. I am triggering the event case and the program is stuck there. So I can't click on the go button any more. But I don't know how to overcome this problem. Please help.
Please try the program attached for clarification of the problem.
01-03-2013 04:41 PM
Edit the event case (right-click->Edit events handled by this case) and uncheck "Lock Front Panel Until Event Completes". The event is being triggered and locking up the front panel. But the code can't execute do to the structure of your code. But since the front panel is locked until that event case completes, you can't press your GO button.
01-03-2013 04:41 PM
Your event case has "Lock Front Panel until this Event Case Completes" set. So you do the mouse move, you've locked the front panel from any activity until the event structure completes, but you can't get to the event structure until you've pressed the go button. A Catch-22.
Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2012 Help
01-03-2013 05:03 PM
Why not handle all of your UI events in the event structure?
01-03-2013 05:06 PM
Thanks.
It solves my problem.
01-03-2013 05:13 PM - edited 01-03-2013 05:42 PM
@babu726 wrote:
Hi,
I am trying to write a program where, I have a while loop running at the beginning to make the program wait for me to click a Go button.
I have an event structure at a latter part of my program, where the event is linked to the "mouse move" on a graph window.
Now the program works fine if you click on the go button avoiding the graph window. But it hangs if you move your mouse through the graph window. I can see the problem why it might be happening. I am triggering the event case and the program is stuck there. So I can't click on the go button any more. But I don't know how to overcome this problem. Please help.
Try to take a step back and try to find a better way to do all this. Who cares if somebody moves the mouse across the graph too early?
Don't micromanage everything and force sequential operation if it does not really matter. Let the code breathe!
The event structure also belongs inside a loop, else the code will complete as soon as the mouse moves inside the graph area and the coord result will probably be quite random.
For example your code could be implemented using a single event structure and a single loop as attached.... modify as needed.
(Now the lock setting is irrelevant, because the event structure is always ready to react. That's how it should be!).