LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure inside while loop

Solved!
Go to solution

I am still fairly new at Labview and this may seem like a simple question.  I am making a subvi to display, edit, and create config files.  I am using a listbox to list all of the sections in a config file and a event structure to update the values under each section when they are clicked.  The problem is that the event structre seems to be pausing the while loop so that the buttons don't function until the event has executed.  What I would like to happen is the while loop to continuously run and the event to execute only when I click in the listbox.  I hope this makes sense.  There is a pic of the block diagram below. Thanks  

0 Kudos
Message 1 of 6
(8,509 Views)

You don't have anything else happening in the loop except for reading of the buttons and controls.  The controls just get passed out of the while loop.  For the OK and cancel buttons, you will want to make some value change events for them as well and place the buttons inside the appropriate event cases.

 

For your boolean wire that goes from the front of the while loop, through the a Not function, then through the Or function, what do you want to do with that?  The value never changes so you could actually put the Not before the tunnel going into the loop.  Do you want those tunnels to be a shift register?

Message 2 of 6
(8,495 Views)
I think I figured it out, I just had to add a timeout event with time to stop it.  Thanks.
0 Kudos
Message 3 of 6
(8,480 Views)
Solution
Accepted by secr1973

There are a number of issues with your code that could cause problems:

  1. You should use the FP.Open method to open the front panel of a VI and the FP.Close method to close it. I don't remember the exact issue, but starting with Ver 7 NI indicated that these methods were the prefered way of performing these tasks.
  2. Based on what the code seems to be doing, the event for the Lumber Presets control should be a Value Change event - not a Mouse Down. After changing the event type, use NewVal from the event data to drive the index input of the array indexer.
  3. The Cancel and Ok buttons should be handled in their own Value Change events. The Cancel Value Change event would exit the loop while passing to the output an error (indicating that cancel had been pressed) and default values for the other 4 outputs. The Ok Value Change event would exit the loop passing out the values that the operator had entered into the 4 front panel controls.
  4. A timeout event witha very short timeout (1 msec) would handle stopping the loop if an error occurred, or the output of the AND gate is true.
  5. The Wait function is unnecessary, as is the Case structure outside the loop.
Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 6
(8,457 Views)
Thanks for the help.  I am trying to do your suggestions but not sure what you mean by the Front Panel open method.  I also don't know how to wire the cancel button like you say.  Here is what I have so far.  Thanks
0 Kudos
Message 5 of 6
(8,413 Views)

The place to start is by educating ourself on event-driven programming, and a good introduction ships with LV. On the LV Getting Started screen, click on the LabVIEW Fundamentals link. When the help opens, expand the Fundamentals heading and you'll see a section on Event-Driven Programming. That's the place to start.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 6
(8,397 Views)