06-17-2013 03:43 PM
I have a VI that can be run both directly as the Top Level VI and also as a subVI of a larger project. I would like to be able to adjust some parts of the VI (ex: hide some of the Controls from view when run as subVI) depending wether the VI is run as the main program or a subVI. So I'm looking for a way to programatically determine if the VI is being run independently or as a subVI...or as subPanel of another VI.
I previously found another post somewhere suggesting to use the Call Chain function. If the array length returned from Call Chain is >1, then you know that the VI is being called as a subVI. This worked great untill I decided it would be nicer to have the VI in a subPanel of the main VI instead of having the subVI pop-up as a new window. When the subVI is called as a subPanel item, the Call Chain only returns 1 item (like its run as a main VI).
Any suggestions on how i can determine if the VI is run in a subPanel instead of as the top level VI?
Solved! Go to Solution.
06-17-2013 04:12 PM - edited 06-17-2013 04:13 PM
Iit seems that a dynamically called VI can't determine its caller. I found a solution but it isn't that elegant: Add a string control to your subVI's front panel. In your caller VI you can set this string control via Control Value Set method to the name of the caller. That works for me.
06-17-2013 04:21 PM
I had resorted to something similar for the time being...I was just using a boolean 'isSubPanel' control instead of a string. I was just hoping there would be something cleaner than this.
06-17-2013 04:32 PM
Maybe you can utilize some front panel properties: A subpanel VI has restricted panel properties, e.g. it is not closeable, not resizable and not minimizable.
11-30-2020 05:48 PM
I was unable to find any properties that differentiated the Subpanel VI from the top-level one (I tried all the ones you listed). Thus I went with the approach of setting a boolean when the VI is called from a Top-level vi and thus is a subpanel VI.