Event Sources

User Interface

The first source of events you come across when starting with LabVIEW™ are the events generated by the UI when a user of your application use the mouse or the keybard.

The Event Structure is the way to detect the event and execute the appropriate caode.

Before the introduction of the Event Structure (a long time ago), LabVIEW developpers had to periodically poll the controls to detect interactions with the User Interface 😓.

Example code: 01a - Event Sources - User Interface.vi

03 event sources ui fp
Figure 1. Front Panel
04 event sources ui dg
Figure 2. Diagram

User Events a.k.a Custom Events

User Events, the worst named feature in LabVIEW™
— John Medland. MLUG October 2020

Behind this name, you’ll find the way to create and generate events programmatically.

This source of events is the corner stones of many event driven architectures. The DQMH framework is probably one of the most popular framework based on the LabVIEW™ user event feature.

Example code: 01b - Event Sources - Custom Events.vi

05 event sources user event fp
Figure 3. Front Panel
06 event sources user event dg
Figure 4. Diagram

Event Callback

This source of event doesn’t involve the use of an Event Structure. Once registred to an event the Callback VI is executed each time the event occurs.

This kind of event breaks the usal data flow we are used to

Example code: 01c - Event Sources - Event Callback.vi

07 event sources callback fp
Figure 5. Front Panel
08 event sources callback dg
Figure 6. Diagram
09 event sources callback vi
Figure 7. Callback VI diagram

Daqmx

This source of event is problably the less known. With it, you can handle acquistion event in the Event Structure. It makes straigtforward the use of the other sources of events in the loop that handle the acquistion.

This example requieres the NI Daqmx driver to be executed.

Example code: 01d - Event Sources - Daqmx Event.vi

10 event sources daqmx fp
Figure 8. Front Panel
11 event sources daqmx dg
Figure 9. Diagram