03-27-2023 01:10 AM
Hello,
Sorry if this is a naive question. I'm trying to convert a VI into a subVI, but I'm unsure of what to do about button operated functions. For context this is essentially a VI used for controlling a camera that I would like to integrate into a larger control scheme. For example, I have a button to press that will take a picture and then labview will do some other stuff to it. Is there a good way to convert the VI into a subVI while still maintaining this level of control?
Thanks
03-27-2023 01:49 AM
Hi daines,
@daines13 wrote:
Is there a good way to convert the VI into a subVI while still maintaining this level of control?
As soon as you call your "VI" from another VI it becomes a "subVI": there is no (explicit) conversion required…
All you need to think of is to show the frontpanel of your (sub)VI upon calling it: open the VI properties dialog (Ctrl-I) and set the frontpanel properties as needed!
03-27-2023 11:32 AM
They are all just VIs.
The only distinction is that SubVIs typically have connector panes assigned, while toplevel VIs don't. For debugging purposes, you can often even run subVI directly.
The first decision you need to make is if the subVI should be interactive or if you just want to call it using values of controls on the front panel of the caller. If the subVI should show the front panel, you need to decide if it should block the dataflow of the caller or run independently. If it should run in the background, you need to ensure that it completes and returns results to the caller without user interaction.
Once we know what you are actually trying to do in more detail, we can give more specific advice.
03-27-2023 03:46 PM
@altenbach wrote:
They are all just VIs.
The only distinction is that SubVIs typically have connector panes assigned, while toplevel VIs don't. For debugging purposes, you can often even run subVI directly.
The first decision you need to make is if the subVI should be interactive or if you just want to call it using values of controls on the front panel of the caller. If the subVI should show the front panel, you need to decide if it should block the dataflow of the caller or run independently. If it should run in the background, you need to ensure that it completes and returns results to the caller without user interaction.
Once we know what you are actually trying to do in more detail, we can give more specific advice.
I'm going to get lexically nit-picky (or maybe white-space-and-case-picky) here. A "sub VI" is a VI that is called by another VI. A "SubVI" is the block diagram object that calls a "sub VI"
03-28-2023 11:11 AM
Back in the days where LLBs were still used, there was actually an option to designate "toplevel" for specific VIs, so we can conclude that everything else in there is not. 😄
(On a side note, it would be cool of e.g. windows explorer would show VIs without connector pane assigned with a different icon and type. There are the ones we typically want to open. 😄 )
03-28-2023 01:08 PM
Everyone seemed to miss this important bit of information...
@daines13 wrote:
Hello,
I'm unsure of what to do about button operated functions.
As you rightly conclude, Front Panel buttons do not belong on sub-vi. Unless of course, you are exposing (displaying) the sub-vi that contains the button, you know, like a dialog box.
The other option would be to determine if the vi is being called by an upper level VI and then simply skip the button functionality.
Third option would be to "press the button" from your calling vi. (It is an option, not a great one, but still an option)
Maybe others will offer more solutions?