06-17-2015 12:16 AM
Hi,
A simple question - when selecting with the right mouse button a control and pressing "Data Operations/Make Current Value default" how I can undo this operation? Imagine I set some control default value to something and after some time I changed my mind and I want to return the control to its initial value (as it comes when you place the control from the pallete - "Set to factory value"). I was not able to figure out how to do this. Cntr - Z is not an option since it works only in the close vicinity of the operation (you can't Cntr-Z this operation after 2-3 hours of intensive work over the VI).
For example I set numeric control default value to 22, after some time I want to return it to initial state (in this particular case the "factory value" is 0). Well, I can reinitialize the value to 0 but it's different from setting it to "factory" settings.
Thank you
06-17-2015 12:32 AM
You try to go on a non-efficient way. This all "default" value thing is not really useful for real LabVIEW applications. It can be handy, but for serious applications always use some sort of configuration file. Imagine if you have to make an EXE executable out of your project? This manual "set as default" will not work anymore for the user!
You can always store different settings in different config files, just look at any other non LabVIEW programs...
Usually applications work in the following way:
http://www.ni.com/tutorial/3478/en/
06-17-2015 12:44 AM
Hi,
Thank you for the fast reply.
I agree that for serious applications this is not a good approach but you should also agree that for simple applications or quick tests the proper initializations of controls through some file is overshooting and extremely sophisticated.
My point is - if I do a quick test for some small piece of code and I want to undo the "Set to default value" operation how I can undo this?
Best regards,
Luben
06-17-2015 12:55 AM
Write the value down on a piece of paper, and after typing it back, you can set it again "as default" 😉
By the way, if you use for example the "MGI Save (Restore) Front Panel Data" VIs from the MGI Application Control toolkit (get it via the JKI VI Package manager), you just do not have to work at all to have such functionality.
http://sine.ni.com/nips/cds/view/p/lang/en/nid/209753
06-17-2015 01:06 AM
Hi,
Well, I'm relieved that I'm not the only one who doesn't know how to undo the default values. The question is simple but fundamental.
Best regards,
Luben
06-17-2015 01:15 AM
I do not see why this is an issue for you. If you make a real code, you go on the config file way (either your own, or for example a toolkit, like the one from MGI).
If you just do quick prototyping/testing, there are many other easy tricks you can use to avoid the need for the "undo default values". I have never met any case in my many years of LV programming when I needed this undo action. Actually if it is only quick testing, why do you need the default values? Store these info in a txt file for example...Copy/paste...
06-17-2015 01:58 AM - edited 06-17-2015 02:00 AM
I disagree with the idea that the default value is not a valuable tool.
One example is let's say you have a subVI that had a hardcoded constant, but in new applications, this value is to be fed in from the outside - i.e., the constant is to become a control connected to the connector pane. This subVI is in a common library so it needs to maintain compatibility with older applications.
So you right-click on the constant to make it a control with the default value already set to the original constant value, connect it to the connector pane and set the connector to anything but required. Now the new software has a connector to hook up to while, even though the old code will have to be recompiled, it won't break because, even though there is nothing wired to the control, the default value works just fine.
I can think lots of other things, but that is among the most useful thing I've done with default values.
[edit] Maybe I took things a little out of context? [/edit]
06-17-2015 02:33 AM - edited 06-17-2015 02:35 AM
"Maybe I took things a little out of context?"
Yes. Of course the default value can be an important option in special cases...
If you intentionally change the default value, you should make a note of the old one (piece of paper, txt file, etc...). If you "accidently" change the default value, just use the ctrl+Z...
About your example: I try to avoid subVI usage with input panes set as not "required" as much as possible (also see the example at the ActionEngine nugget about "wrapping up"). This can cause often user programmer mistakes.
06-17-2015 03:15 AM
Hi,
I think we need to focus on the question - how to undo default values and not to drift away by discussing is it useful or not (which technically is completely different question).
Using default values is very useful feature - in subVI you can set some controls with default values and their terminals may be left unwired in the main VI. It's actually used very often in NI VIs - you can often place a control which has multiple input terminals but you don't have to wire all of them and rely on the default values.
In my case I have a large 2D table and I need to test very complex algorithm for detecting multitouch obejects and extracting the multitoch positions. Using default values and undoing them may be important feature when developing and testing the code.
Also the question is fundamental - there is an option to use current values as default values, there is an option to set the control to default values but I'm missing how to set the default values to factory setting.
Thank you
06-17-2015 03:40 AM
"In my case I have a large 2D table and I need to test very complex algorithm for detecting multitouch obejects and extracting the multitoch positions. Using default values and undoing them may be important feature when developing and testing the code."
Why do you make your life difficult? You have to spend some minutes to program a config file feature, so you can handle multiple config files storing your large 2D table data. Or use the MGI toolkit as I wrote above. You just argue about you miss a feature, but instead of that you can easily solve your problem with a few minutes of programming.