LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Make current value default - Undo action

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

0 Kudos
Message 1 of 14
(3,491 Views)

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:

 

  1. Initialize state: look for config file in some default folder, if found load it and set the control values which were stored in it. If no config file found, just use default values.
  2. During runtime: you can give the user the option to load a config file and update the controls, or save an actual control value set as a new config file for example.
  3. Stop and close application: you can program it in a way that the program saves the actual state in a config file (or not).

http://www.ni.com/tutorial/3478/en/

 

 

0 Kudos
Message 2 of 14
(3,478 Views)

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

0 Kudos
Message 3 of 14
(3,468 Views)

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

 

 

 

0 Kudos
Message 4 of 14
(3,460 Views)

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

0 Kudos
Message 5 of 14
(3,455 Views)

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...

0 Kudos
Message 6 of 14
(3,448 Views)

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]

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 14
(3,434 Views)

"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.

0 Kudos
Message 8 of 14
(3,405 Views)

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 

0 Kudos
Message 9 of 14
(3,391 Views)

"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.

0 Kudos
Message 10 of 14
(3,381 Views)