05-04-2011 08:54 PM
Hi,
Is attached a valid way of using the event structure? I always hear that the event case should contain the control of the event. Can the control be placed else where? For example, if I have 2 loops, I placed an event structure in the 1st loop and the control associated with the event in the 2nd loop, would there be any potential problem? Is it true that regardless where a boolean with a value change is read, the value chagne in the event structure will be fired? See attached.
Solved! Go to Solution.
05-04-2011 09:04 PM
That screenshot you posted should work just fine for you.
The main reason you hear that the event case should contain the control for the event is so that the control gets read, and for latching booleans, gets reset when the event case executes.
Here since the parallel while loop is executing (assuming nothing else in the loops causes the loop to get blocked), the stop button will get read and reset. The value change event will still be fired in the upper event structure loop.
05-04-2011 09:25 PM
So is the only reason of placing the control in the corresponding event case to reset the control? We don't really need to read the value from control directly from the control, since ther terminal of the event structure would give me the value of the control, correct?
05-04-2011 11:04 PM
Correct.
You can either read the terminal in the event case, read the New Value node inside the event case, or in the case here where you just care that the boolean changed because you can pretty much assume the stop button was false to begin with, you aren't reading the boolean value at all in the event structure and are just relying on the fact the event case was fired.
05-05-2011 12:31 AM
@jyang72211 wrote:
So is the only reason of placing the control in the corresponding event case to reset the control? We don't really need to read the value from control directly from the control, since ther terminal of the event structure would give me the value of the control, correct?
That, and it makes it easy to find if you in general place controls in their event cases.
/Y