05-03-2015 04:45 AM
I have a VI consisting of three sub VI's which perform the same application. I would like the program to pop up a dialog box asking the user which subvi he would like to proceed with. The program should lead to the appropriate sub vi and continue upon the user prompt. What can I do about this in LabVIEW 2012?
05-03-2015 06:23 AM - last edited on 01-08-2025 08:47 AM by Content Cleaner
05-03-2015 06:27 AM
Save the above snippet (png file) to your PC, and drag&drop into your block diagram.
05-03-2015 07:20 AM
Blokk showed you how, if you had a Modal Dialog VI that would ask you "Which option do you want?" and would wait for you to answer the question, you could use to choose which option to do. So now it boils down to writing the Modal Dialog VI.
Write an ordinary VI that lets you choose one of three options. You can use a Radio Button box, or three booleans (with a Text label saying "Please choose one of the following". You can decide "When I make a choice, then I'm done and can exit" (you can use an Event Structure to do this) or you can have a pair of buttons, called "Accept Choice" and "Cancel Choice", that the user is required to push. You design how you want to handle this, and make it happen.
Now, before saving this sub-VI, right-click its icon and open its Properties. Go to the Window Appearance, and choose Dialog. Now push Customize, but only look, don't change anything. Notice some interesting properties have been set -- the VI will "Show its Front Panel when called" (so you can see and interact with its controls) and will "Close afterwards if originally closed" (so it "goes away" when you are done). Notice the Window Behavior is Modal, which means it "sits on top" of other windows and holds things up until it finishes.
If you want, you can go into the Window Run-Time Position and change the Position to Centered (so it pops up right in the middle of the screen, instead of "Where you last saved it".
You now have a Modal Dialog Box that will pop up, allow you to make a (very flexible, you-program-it, choice), and will disappear when you've made your choice.
Bob Schor
05-03-2015 08:09 AM
I dont seem to have the dialog using events vi, could you upload it?
05-03-2015 08:17 AM - last edited on 01-08-2025 08:48 AM by Content Cleaner
Did you read what I wrote at my post?
"Save the above snippet (png file) to your PC, and drag&drop into your block diagram."
The picture what you see is a png file which also includes the actual VIs, called snippet. Right click the picture, and choose "Save image as...". After you have saved this png file to your PC, you can drag and drop into an empty block diagram window for example...
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2PkCAI&l=en-US
05-03-2015 09:13 AM
Blokk,
This is from the note you referenced:
You can create VI Snippets that reference SubVIs but your end users need to have the SubVIs on their machines to be able to use the code. VI Snippets only contain information from the block diagram you create them from. If your code segment contains a SubVI, the SubVI is not embedded in the VI Snippet.
The Original Poster's request is very reasonable, and why I provided the discussion of Modal Dialog Sub-VIs, as your sub-VI is not part of the Snippet you posted.
Bob Schor
05-03-2015 09:22 AM
Yes, you are right, sorry, my mistake.
SubVI attached.
05-03-2015 09:27 AM
also in LabVIEW version 2012...
05-04-2015 08:20 AM
Could you upload an example VI which works with the radio button box and the event structure?