LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using one vi to serve as a main menu with buttons that open sub-vi's: Problem with closing said sub-vi's, since I use .vit files, it prompts me to save upon exit of each subprogram

Quick summary (go down lower to see questions):

This program is intended to hook up any number of devices over a std-mil-1553 bus. There are two hard coded device types and a generic type. Since one may have two of the same device, I want the user to be able to open as many, say... DC/DC converter windows.

Browsing the forums here, I managed to figure out:
1. How to run the subprograms while allowing the main menu to keep running (by opening the vi's using references)
2. How to open multiple front panels using .vit files.

The problem is, when you finish using one of the su
bwindows, closing it prompts you to save changes to the .vi file that is generated.

---
Source code is attached.

Questions:
1. Is the .vit method the way to go?
2a. If so, is there a way to suppress the save prompt.
2b. If not, how should I allow for multiple instances of the same .vi?

Thanks much, source code follows,

-Dobbs
0 Kudos
Message 1 of 13
(3,563 Views)
You'll find attached the way to code your template so that the save dialog is prevented. THe dialog doesn't occur when the front panel is closed using a property node.

Tips: In your main panel, close VI references and add a wait(ms)in the loop so it doesn't run wild polling the booleans.


LabVIEW, C'est LabVIEW

Message 2 of 13
(3,563 Views)
Now, is there a way that I can make it so that one closes the window using the windows 'X' button and no save prompt is generated?

I see how this one works, so if the 'X' method is impossible, I can make a labview close button. I was just doing the 'X' way for aesthetic reasons.

Thanks, by the way,
-Dobbs
0 Kudos
Message 3 of 13
(3,563 Views)
Dobbs,
In the template example, the panel is actually closed with the X button without save dialog. Forget my previous comment.


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 13
(3,563 Views)
Hmm, I took my original .vi and wired your .vi to the generic case.

The stop button succesfully closes the new "timedloop 1.vi" that is generated when called without a save dialog.

However, the "X" button prompts for save.

If you just run it by itself, it will work of course, because no changes have been made. However, the instantiation of the template creates a new file that windows wants to save.

Any ideas?

-Dobbs

Any ideas?
0 Kudos
Message 5 of 13
(3,563 Views)
*could have swear it worked with the X button...*

Indeed it makes sense... you created a new VI in the LabVIEW environment so it asks for saving it before closing the panel.

One thing you can try (I didn't) is to use a Winodws utility on NI zone here. It allows you to intercept the window closing message and close the panel programmatically.

In Run-Time environment, the dialog won't appear. So if it is intended for Run-Time, you can let the code as is. If not you can save the VI programmatically to a dummy place when it is run so the save dialog won't appear again.


LabVIEW, C'est LabVIEW

0 Kudos
Message 6 of 13
(3,563 Views)
Hmm.. I tried to build the thing and my original method for dynamically opening and closing windows doesn't seem to be working at all at runtime.

It works in development, though.

That is, if I take my original .vi and change one of those file opening strings to timedloop.vit instead of whatever it was before, it will open in development, but will not at runtime.

I just did "include top level vi" as 1ck.vi and included timedloop.vit as a support file. This is my first time using the app builder, so any idea why it's not creating windows at all?

Thanks again for helping!
0 Kudos
Message 7 of 13
(3,563 Views)
Actually, the sub vi's used to be in the same directory, but after building they were put in data.

So I changed the original program that opened the .vi's so that it had the right paths, and it worked at runtime from the same directory as the executable.

Next I'm going to try an experiment using your timedloop and my old program. My day is up, however, so I'll have to get back to you with the results tomorrow. If you have any suggestions, though, go for it.
0 Kudos
Message 8 of 13
(3,563 Views)
Strangely, this program (which also opens things dynamically) works perfectly fine, I'm trying to discern the difference currently.
0 Kudos
Message 9 of 13
(3,563 Views)
And another reply, this time with the .vi:
Download All
0 Kudos
Message 10 of 13
(3,563 Views)