To download NI software, including the products shown below, visit ni.com/downloads.
Using a blended application architecture, this VI exhibits different behaviors from the same event in an event structure.
Real estate on the front panel is a valuable resource. In many applications, it is not necessary to provide the user separate controls for "initialization" and "process-start", or "open file" and "modify file". Typical use of event structures would require a separate control for each, even though from the user's standpoint, the operations are synonymous. From a programming point of view, the operations are certainly different and demand significantly different code.
To maintain the rigors required of well-designed code and maintain an intuitive UI, it is possible to have the code conditionally execute different behaviors from the same Event Case. The attached example is very simple, but the method demonstrated scales reasonably well to larger tasks and programs. What is built in this example, is an event structure with a state machine inside one of the event cases.
LabVIEW 2010 or later
Front Panel of the VI
Behavior elicited on first click of the Go button.
Behavior elicited on subsequent clicks of the Go button.
Block diagram code snippet.
An alternate method not demonstrated here registers multiple dynamic events with the Event structure, and then conditionally fires them from elsewhere in the code using the Generate User Event.vi.
Note: The attached code is designed to work in LabVIEW 2010 or later.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.