LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure Help?

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.

0 Kudos
Message 1 of 6
(2,722 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(2,720 Views)

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

0 Kudos
Message 3 of 6
(2,719 Views)

Why not handle all of your UI events in the event structure?



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 6
(2,710 Views)

Thanks.

 

It solves my problem.

0 Kudos
Message 5 of 6
(2,708 Views)

@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!).

Message 6 of 6
(2,705 Views)