I've made a Drop In VI where the user Alt+Right Clicks the control and a one button dialog fires to show the description of the control. Only bad thing is, the one button dialog inside the drop in stops the entire program until the user clicks OK on the dialog. Any way to get around this? It crashes my program if the user forgets to click OK after too long. Any help is appreciated.
Solved! Go to Solution.
Sounds like you need to have your popup run in another while loop. Since you did not attach any code I assume your subvi is in your main loop. Which means the entire loop stops as the popup launches and waits until you close it and then continues. Bad things can happen if you do not code popup boxes correctly.
In the early days I had a popup on a program that ran a thermal chamber. Luckly I was standing next to the chamber when the popup happened, because just before the popup the liquid nitrogen valve opened. Which stayed open until I closed the popup, so things got a little exciting for a few seconds. But I learned not to do that again.
This is just a drop in on the main BD. It is not in any other loop. It's a little messy still (not 100% done with it). This would be place inside a parent VI's BD with the parent's reference attached to it. Can't seem to figure out why, in it's own loop, it freezes the whole program...kinda weird. Take a look at the code if you want.
Also, it has been switched to ALT not shift anymore
The timeout feature on an Event structure does not abort the current code running inside the structure. I tried it to verify, and the program still crashes. I saved it as 2010 below.
the way to do it is by creating a sub.vi with your front panel being the diaglog message, make the sub.vi window appearance custom with modal,show front panel when called and close afterwards all boxes check in properties...block diagram should include while loop and event structure with whatever timeout you want
That's a good idea. I might just end up doing that. Kinda defeats the purpose of a single drop-in VI, but whatever gets the job done sometimes I guess. Thanks.
Can't seem to figure out why, in it's own loop, it freezes the whole program...kinda weird. Take a look at the code if you want.
I'm going to guess this is related to the "root loop" - there are some notes here: http://labviewwiki.org/Lessons_learned_from_plugins. Certain operations, including displaying Windows dialogs and menus, go through a section of code that cannot be (or at least isn't) multithreaded. Any other operation that also needs to go through that same section of code will block until the dialog or menu is dismissed.
Apok's solution can work, but that dialog VI still needs to be placed in its own loop, of course - otherwise the dialog will still block the loop in which it's placed (other parallel functions will run, but the loop won't iterate) until the dialog is dismissed.
Good to know. Thanks for the help everyone.