Example Code

Non-Blocking Multibutton Dialog Box

Code and Documents

Attachment

Description:

This example implements a Dialog Box like the 1,2,3-Button Dialog boxes from LabVIEW. The key difference is that it allows its calling VI to keep running in the background.

Other implementations are definitely possible, such as polling the Front Panel status of the popup VI, but the implementation uses a Start Asynchronous Call to start the VI running the the background. The User events help prevent race conditions and also show how you can use them across VIs.

Instructions:

  1. Open the Main VI; keep the Front Panel visible
  2. Run the Main VI, the Popup Window.vi should appear in the center of the screen.
  3. Notice that the iteration count is still increasing while the Popup Window is open.
  4. Click any of the buttons on the Popup Window and notice the "Button Pressed" indicator update.
  5. Close Window will minimize the Popup Window and allow you to make it popup again via the Main VI.
  6. Stop the execution via either the Stop Button on the Main VI or Popup Window VI.

I have converted it back to LabVIEW 2011 (also have LabVIEW 2012 SP1 attached) due to Start Asynchronous Call not in earlier LabVIEW versions. A similar Run VI method would work, but the User Event queues would have to be passed differently.

MainBD.png

MainFP.png

PopupFP.png

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors