02-21-2013 11:46 AM
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.
02-21-2013 11:59 AM
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.
02-21-2013 12:18 PM
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.
02-21-2013 12:18 PM
Also, it has been switched to ALT not shift anymore
02-21-2013 12:39 PM
Thanks for attaching your code, but I have not installed 2012 yet. Hopefully apok's answer works for you.
02-21-2013 12:51 PM
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.
02-21-2013 01:07 PM - edited 02-21-2013 01:24 PM
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
02-21-2013 01:20 PM
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.
02-21-2013 02:08 PM
@Nathan_S wrote:
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.
02-21-2013 02:12 PM
Good to know. Thanks for the help everyone.