LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Confused about Event structure..

You could have attached the actual VI and not a partial image of a block diagram. That would be the best way to get a recomendation on how to make it smaller.
0 Kudos
Message 11 of 16
(778 Views)

It is easy to create sub vis. Just select the code you want and select "Create sub vi" from the "Edit" menu.

You can use references to handle your controls of GUI, inside sub vi's.

With the above method, references are auto created

0 Kudos
Message 12 of 16
(752 Views)
For example I want to process the event of pressing on a button. What is the difference when I place the button inside the Event structure and outsided the Event stucture?  Thanks.

0 Kudos
Message 13 of 16
(718 Views)

Good question.. This is not the official answer.. Just "hear-say".. 😉

Having the button inside or outside the Event Structure does not affect the operation of the structure.  It is a recommended approach to keep the code tidy (clean), to make sure that the button is not used elsewhere (event handled by the Event Structure), and that if you need it's value, you can wire directly (although there is another way of doing that).

As a coding practice, I always add the button within the Event case that handles it.

Anyone with a more formal answer?

RayR

0 Kudos
Message 14 of 16
(713 Views)
If it is a 'Latch' type button, the latch doesn't get cleared until the actual Terminal is read by the program.  Thus if you are using a latch boolean, if the terminal is not read it won't register any more events.  By putting it in the event case, you are guarenteeing that the latch will be read and cleared and thus reset for more events.
 
Check the LabView help, Caveats for working with Event structures, second item 'Using Events with Latched Boolean Controls'.
Jon D
Certified LabVIEW Developer.
Message 15 of 16
(707 Views)
Thanks Jon for reminding me of this:
 
"By putting it in the event case, you are guarenteeing that the latch will be read and cleared and thus reset for more events."
 
Very important to remember..    (now... why did I forget this???!!!???)
0 Kudos
Message 16 of 16
(704 Views)