Jump to content

Event Handler: Difference between revisions

From LabVIEW Wiki
m Category reorg
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
The '''Event Handler''' design pattern provides a powerful and efficient architecture for handling user interaction with LabVIEW. Use the event handler for detecting when events occur such as a user changing the value of a control, moving or clicking the mouse, or pressing a key, etc. The standard event handler template consists of an Event structure contained in a While Loop. Configure the Event structure to have one case for each category of event you want to detect. Each event case contains the handling code that executes immediately after an event occurs.
The '''Event Handler''' [[Design Patterns|design pattern]] provides a powerful and efficient architecture for handling user interaction with LabVIEW. Use the event handler for detecting when events occur such as a user changing the value of a control, moving or clicking the mouse, or pressing a key, etc. The standard event handler template consists of an [[Functions Palette/Programming/Structures/Event Structure|Event structure]] contained in a [[Functions Palette/Programming/Structures/While Loop|While Loop]]. Configure the Event structure to have one case for each category of event you want to detect. Each event case contains the handling code that executes immediately after an event occurs.
 
 
[[File:Event Handler Design Pattern.png|centre|frameless|491x491px|Event Handler Design Pattern]]
[[File:Event Handler Design Pattern.png|centre|frameless|491x491px|Event Handler Design Pattern]]



Latest revision as of 14:55, 20 July 2021

The Event Handler design pattern provides a powerful and efficient architecture for handling user interaction with LabVIEW. Use the event handler for detecting when events occur such as a user changing the value of a control, moving or clicking the mouse, or pressing a key, etc. The standard event handler template consists of an Event structure contained in a While Loop. Configure the Event structure to have one case for each category of event you want to detect. Each event case contains the handling code that executes immediately after an event occurs.


Event Handler Design Pattern
Event Handler Design Pattern

Use Cases

Dialog Boxes

Creating New from Templates in the LabVIEW IDE

The Event Handle is suited for use in simple dialog boxes where there might be some input like a message presented to the user, the user makes a selection, and then the users' choice is the output. From File -> New..., then listed in the "From Template\Frameworks" folder there exists a template for making simple dialog boxes with OK and Cancel selections.