05-05-2009 02:57 PM
Hello,
I have an application that was originally coded in LabVIEW 8.0, Windows XP. One part of the program utilizes a VI template (.vit) to open multiple instances of a subVI for the user. In versions prior to 8.6, when the VI was called via the VI server and then closed pragmatically, it did not spawn a "Save Changes..." dialog. Upon upgrading the application from LabVIEW 8.5 to 8.6.1 the "Save VI..." dialog shows up when the .vit subVI's are closed. After investigating the behavior, I have determined that inclusion of Express VI's (I haven't tested them all, but I've tested several) cause the "Save VI..." dialog to open when closing the .vit pragmatically. What's interesting is that it exhibits this aberrant behavior even if the express VI is in the disabled pane of the diagram disable function. (I thought that's supposed to remove the code from compilation completely?).
I've attached an example program that illustrates the behavior. Run "Call Template.vi". Select either the subVI with or without the express VI in the diagram disable function. Note that when closing the VI via the "stop" button with the express function the "Save Changes..." dialog opens and it does not with the express VI absent. I have only seen this behavior since upgrading to LabVIEW 8.6.1.
My only current workaround is to remove all express VI's from my application. Luckily this has been possible however I have had to use the "File Dialog" compatibility primitive (instead of the express VI file dialog) which claims not to be supported. It took a while to find that function: I had to find an old program and copy the vi.
Any other suggestions on fixing this issue?
05-06-2009 02:11 AM
If you've got an event structure in the vit, you could catch the Application Instance Close Event and use the silent shutdown terminal.
Felix
05-06-2009 10:47 AM
F. Schube,
Excellent idea however there are a couple reasons this wouldn't work:
1) I want the user to be able to close a sub-window without having to terminate the entire Application Instance. There are other VI's running in the same instance that can't be closed. So I can't really use this event.
2) For strictly academic reasons, I coded it up to see if it would work. Even with Silent Shutdown wired as true, you still get the "Save Changes..." dialog when the event fires. (It turns out the best way to get the event to fire is killing LabVIEW with the task manager.) I've attached the modified example.
05-06-2009 12:03 PM
Didn't take a look at your code before. You need the option 0x08 (reentrent execution) on the Open VI Reference function to run the template, otherwise you generate a new vi from that template.
Hope that's it, I can't test it.
Felix
05-06-2009 04:39 PM - edited 05-06-2009 04:40 PM
The subVI is not reentrant, so setting the 08h code causes an error and it wont load. I'm not calling the subVI via the "call by reference" node. I'm using just the plain methods and properties. I've attached a screenshot of "Call Template.vi".
05-06-2009 05:23 PM
Hi Chris,
Why are you trying to execute templates. As you can read in the LabVIEW Help templates are for getting started building common applications. Templates are not meant to be executed.
The expected behavior for what you are doing is that you should be prompted to save both VIs. When you execute your code it creates a new VI. Notice that the menu bar has the title of the template followed by a number. That is the name of the new VI that was created from the template.
If you save the VI that is created and then run your application with that VI you are not prompted to save it. I would suggest not using templates, but use VIs.
Best Regards,
05-07-2009 08:20 AM
I am never sure when this comes into effect but try checking...
Options >>> Environment >>> Trreat read-only VIs as locked
and
Options >>> Environment >>> Do not save automatic changes
The first enables the second and the second will inhibit the save that triggers the Save dialog (under some circumstance).
Just trying to help,
Ben
05-07-2009 11:05 AM
Brian H./Hesloppy,
I'm not sure why I need to explain this to an NI employee, but it would behoove you to familiarize yourself with your company's product:
http://digital.ni.com/public.nsf/allkb/98847B4E4C715E6D86256C59006B57CC
http://zone.ni.com/devzone/cda/tut/p/id/3095
It will also help you to understand the problem by running the code that I posted to see how this behavior works. It is only when express vi's are in the program that causes the proper behavior to break. It's especially disturbing that the express VI in the diagram disabled function breaks the proper behavior.
Reentrant VI's are not really intended to have a front panel. It's only in the last few versions(maybe 8.2?) that the front panel was even accessible for reentrant VI's while running. VI templates are the proper way to have cloned user interface front panels.
05-07-2009 11:10 AM - edited 05-07-2009 11:16 AM
Ben,
Thanks for the suggestion. I would have never thought to look at these options. Unfortunately, I set the options and it didn't seem to help. I still get the the "Save Changes..." dialog with express VI's in the .vit.
05-07-2009 11:14 AM
This problem might be loosely related to this thread:
http://forums.ni.com/ni/board/message?board.id=170&message.id=78661&requireLogin=False