LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bypass One Button Dialog in While Loop

Solved!
Go to solution

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.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 1 of 10
(4,298 Views)

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.Smiley Wink 

 

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.

Message 2 of 10
(4,294 Views)

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.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 3 of 10
(4,292 Views)

Also, it has been switched to ALT not shift anymoreCat Happy

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 4 of 10
(4,290 Views)

Thanks for attaching your code, but I have not installed 2012 yet.  Hopefully apok's answer works for you.

0 Kudos
Message 5 of 10
(4,272 Views)

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.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 6 of 10
(4,265 Views)

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

Message 7 of 10
(4,260 Views)

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.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 8 of 10
(4,245 Views)
Solution
Accepted by topic author Nathan_S

@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.

Message 9 of 10
(4,224 Views)

Good to know.  Thanks for the help everyone.

--------------------------------------------------

Nathan - Certified LabVIEW Developer
0 Kudos
Message 10 of 10
(4,218 Views)