Event Handler: Difference between revisions
mNo edit summary |
mNo edit summary |
||
(3 intermediate revisions by 2 users 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]] | ||
Line 5: | Line 7: | ||
=== Dialog Boxes === | === Dialog Boxes === | ||
[[File:New Dialog - Dialog Using Events.png|thumb| | [[File:New Dialog - Dialog Using Events.png|thumb|600x600px|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. | 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. | ||
[[Category:Design | [[Category:Basic Design Patterns]] | ||
[[Category:LabVIEW fundamentals]] |
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.

Use Cases
Dialog Boxes

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.