LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring a subVI to have a configuration window/dialog box

I am attempting to write my own slope/y-intercept calibration subVI for a program I'm building into an executable to be used on another machine.  The program is a generic DAQ program and I want the user to have some control over the calibration of the incoming signals.

My questions are these:
  • how can I configure the subVI to have a boolean input that when asserted will open that particular subVI's Front Panel.  I would also like to have a "Close" or "Cancel" button that closes that front panel once the user has changed those values.
  • am I using the Configuration Data sub vis properly?  It seems pretty obvious.  I would like there to be a "config.cfg" file created/openned/written to in the base folder of my final executable.  Can multiple instances of this subvi use the same file?  I assume so, because there are "section" inputs for the writting and reading Configuation Data subVIs
Inputs:
  • (bool) Open Front Panel
  • (string) Instance Label (wired to the "section" inputs for the writting and reading configuration data subvis).
  • (dbl) Input (x)
Output:
  • (dbl) output (y)

Thank you for your help.

-Nic
0 Kudos
Message 1 of 6
(3,148 Views)
Woops!  Forgot to attatch the file!  Smiley Very Happy

Here it is:
0 Kudos
Message 2 of 6
(3,137 Views)
Your problems isn't really with the config VIs but rather your VI's architecture. It sounds like you want this VI to be used as a subVI that simply gives you "output" when you set a "display" boolean input to False. If the boolean input is set to True then the subVI should display itself allowing the user to click the buttons. Well, your subVI's architecture needs to change. You need to have a case structure that will run only if the "display" is True. The code to execute in this case should be a simple event structure. See attached example as a suggested alternative.
0 Kudos
Message 3 of 6
(3,120 Views)
Thank you for your reply.  I have thought about what I was trying to accomplish and have determined that maybe I should have my slope and y-intercept information for each of my channels controled by a seperate "setup" program and just have my subvi's read the information from the configuration file.  I am having some problems with this, and will post a new thread on my problem shortly.

I will review your solution as I will be using this method to bring up "sub-windows" to larger programs that will require configuration from within pretty soon.  A lot of the programs I'm working on these days I did not initially write.  The original author decided to have ALL the configuration controls on one super large front panel.  Very unneccessary.  So I will be creating buttons that open up "preferences" type windows that write configuration files.

Thank you for your reply!
-Nic

0 Kudos
Message 4 of 6
(3,116 Views)
I have reviewed your code.  I noticed that the "Open VI Reference" is wired to reference the current VI using the "Current VI Path" constant.  Is there a better way of self referencing that relies on an instance of a subVI.  I ask, because this subVI is suppose to be re-entrant.  I will have multiple instances of it within a single program and each instance should pull up its own Front Panel.  Can this be done?

Thank you for your code, it will aid me greatly.

-Nic
0 Kudos
Message 5 of 6
(3,111 Views)
To your direct query regarding the reference: You can use either a path or the name of a VI (as a simple string) for the "VI path" input. If you use a string value with the name of the VI then that VI must be in memory. I plopped down the "Current VI's Path" simply as a convenience and as a demonstration. This is not affected by the VI being reentrant or not.

The way my example is coded is not the way you would code popup panels. It's coded that way because of your original post and the code you posted which seemed to imply that you were trying to use the subVI in one of two modes. The better solution is to separate out the preferences setting from the calculation while the code is running. For the popup panels you would not need the code that deals with the VI Server stuff since you can configure this behavior directly in the VI's Properties in the "Window Appearance" section.
0 Kudos
Message 6 of 6
(3,105 Views)