05-14-2009 05:13 AM
I have a vi that is used as subvi and whose front panel has got 4 tabbed pages and each tab has got controls now there are two things that I need
1. The front panel of the subvi has OK and CANCEL buttons
- OK button should
make the current
panel values the new
default, so that next time the app is closed and
reopened these
new values will be in place.
- CANCEL button will
undo
the changes and
reset the controls back to the default state.
I have tried using invoke node to set the current values to the default state but no luck
I have attached the screen shot of the vi (done with online help) related to this pls have a look and tell me if it is correct and if not pls give a suggestion.
2. After setting the values I want to write these values of subvi into the microcontroller when I press the button on the main vi how can I do that ?…..I was successful in opening the front panel window of subvi from the main vi but how can I configure these values………
Here I am attaching the screen shots of my VI pls check and tell me if my way of assigning controls to the tabbed window is correct and if not how can I do that ?
Solved! Go to Solution.
05-14-2009 05:55 AM
Samantha,
"Make Current Values Default" method will work only when the VI is in Edit mode, NOT in Run mode. This is what the LV online help says, I think... Moreover, in Cancel event, you are just reinitializing the Cancel button's value to its default, NOT the variables of the VI itself.
05-14-2009 06:01 AM
05-14-2009 06:03 AM
05-14-2009 06:33 AM
Hi Samatha,
Good afternoon and I hope your well today.
Thanks for the post.
1. As parthabe has pointed out, you can't update the defaults for a VI at runtime, you can only set the front panel settings back to the default. If you wish to have this functionality, I would suggest using a config file (text file) where you can store all the control/indicator values. You could load these and update them. i.e. when you start your VI it will load the settings from the file, when the user clicks the ok (Save Config File) save to the file, and if they press cancel then just don't update the file.
Now I just had a quick look on the NI Community pages, and I found this example - which examples how I would do it:
Programmatically saving and loading values of all front panel controls
You should be able to adjust this example to meet your needs, if you wish to be able to update the defaults during runtime.
2. There are a few ways to pass data between top-level VIs and subVI. What methods have you tried? If you require your subVI to run in parallel with your top-level(main) VI then you may wish to consider calling the VI dynamically using VI Server. Using the VI Server methods you can update/read from controls/indicators using the Get/Set methods. If you simply want to call the VI, execute it and return to the main VI then you can use the connector pane of the subVI to wire data into and out of the subVI. Please let me know more details.
Hope this helps,
05-14-2009 07:32 AM
12-21-2009 05:18 AM
Hello,
has anybody an idea, why the example code linked above has problems with enums (see example)?
transfererror
12-21-2009 01:04 PM
Can you tell us what problems it is having with enums?
I don't think that is a very good example. Having two event structures in the same while loop means the loop can't interate again until both event structures have executed.
01-04-2010 03:27 AM
Hello,
when loading the saved configuration, I'm getting the following message:
Error 1 occurred at Invoke Node in Programmatically Save Control Values 86 _ to be debugged.vi
Possible reason(s):
LabVIEW: An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
=========================
NI-488: Command requires GPIB Controller to be Controller-In-Charge.
Method Name: Control Value:Set [Flattened] (Deprecated)
"Enum" type descriptor does not match
As you can see, there is a problem with the "Enum" type. Do you have any idea?
transfererror
P.S.: I only modified the above linked example. In my programs I don't use two structures in the same loop. But this is not the problem here.
01-04-2010 10:21 AM