LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

make current values default

Hello ng,
Can anyone tell me how to programatically make
the current values of all controls on a panel the
default values?
Furthermore, can I set all controls back to their
default state programatically?

Thanks!
Charlie Solomon
Raytheon Systems Co.
charliesolomon@yahoo.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 1 of 11
(6,449 Views)
In article <7qk261$53i$1@nnrp1.deja.com>, wrote:
>Hello ng,
>Can anyone tell me how to programatically make
>the current values of all controls on a panel the
>default values?
>Furthermore, can I set all controls back to their
>default state programatically?

To make them the default values individually, you can right click on the
number, go to "Data Operations," then hit "Make current value default."

I can't tell you how to do all of them at the same time, if that is what
you mean.

To make them go back to default, same thing, right click the number, go to
"Data Operations," then "Reinitialize to Default."

Hope that helps,
Harry

--
"Little Joe for the Big Heisman, '99"
0 Kudos
Message 2 of 11
(6,449 Views)
That's a good question. I almsost positive there's not a direct way to
prgramatically get them back to default values.

Two ideas:

For every control you want to set back to a default value, make a copy
of it on your front panel, and set the default value. Now, when you
want your control to go back to default, set it via a local variable
("Copy of Control A" -> 'Write' local of Control A). If you have a lot
of controls, you can control them with a cluster. Just make sure you
never overwrite the Copy of the control.

Or, this idea is weird, but might work well in your situation... since
default values are only assigned if there is no other input, you could
make the variable you want to reset and put it in a sub-VI which
consists of one input and one output wired toget
her. In that sub VI,
set the default value of the control. Now, on your outer VI, if you
ever want to assign it its default value, wire up the sub VI with a
'Write' local of the control.

Rick
--

rick@csciences.com

Chesapeake Sciences Corp.
1127B Benfield Blvd Millersville, MD 21108

Tel: (410) 923-1300 x3430 Fax: (410) 923-2669
0 Kudos
Message 3 of 11
(6,443 Views)
> For every control you want to set back to a default value, make a copy
> of it on your front panel, and set the default value. Now, when you
> want your control to go back to default, set it via a local variable
> ("Copy of Control A" -> 'Write' local of Control A

Thanks Rick,
That would work for resetting controls to the same default values every
time...I should explain my app better: I have a subvi that pops up
a "setup" panel, allows the user to change some controls, then gives
the option to Save or Cancel. Save 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.


Only thing I could find in the Help was some reference to
a "Make_Current_Values_Default" DLL, but no info on how to find it or
access it. Thanks,
Charlie


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 4 of 11
(6,443 Views)
Are we talking about LabVIEW 5 here? If so check out the VI Server
functionality.
In the Functions palatte under Application Control you can open a VI
reference to
a VI with Open VI Reference and then using the Invoke Node you have both
"Make Current Values Default" as well as "Reinitialize All to Default
available".
These functions match exactly the same commands in the Operate menu.

charliesolomon@my-deja.com wrote in article
<7qkdgv$di6$1@nnrp1.deja.com>...
>
> > For every control you want to set back to a default value, make a copy
> > of it on your front panel, and set the default value. Now, when you
> > want your control to go back to default, set it via a local variable
> > ("Copy of Control A" -> 'Write' local of Control A
>
> Thank
s Rick,
> That would work for resetting controls to the same default values every
> time...I should explain my app better: I have a subvi that pops up
> a "setup" panel, allows the user to change some controls, then gives
> the option to Save or Cancel. Save 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.
>
> Only thing I could find in the Help was some reference to
> a "Make_Current_Values_Default" DLL, but no info on how to find it or
> access it.
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 6 of 11
(6,443 Views)
Invoke Node was exactly what I needed...however, "Make current values
default" is not working. I get an error msg saying "current state is
not compatible with this command." I've tried using the Set State
method to unlock or lock the VI with no luck. Any ideas? Thanks,
Charlie
ps - Reinitialize to defaults works great!

"Rolf Kalbermatter" wrote:
> Are we talking about LabVIEW 5 here? If so check out the VI Server
> functionality.
> In the Functions palatte under Application Control you can open a VI
> reference to
> a VI with Open VI Reference and then using the Invoke Node you have
both
> "Make Current Values Default" as well as "Reinitialize All to Default
> available".
> These functions ma
tch exactly the same commands in the Operate menu.
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 7 of 11
(6,433 Views)
You can't make current values default for a running or active VI. This
means
you can't do this from inside the VI but rather need to do it form another
VI
and before or after you executed that VI. The VI may alslso not be a subVI
of
another running VI as it is then also running or at least in a prepared for
running
state.
Also you will need to save the VI afterwards if the default values need to
remain
over a restart. You can save a VI with Invoke Node, too but the save
operation
does not work in a standalone application (created with the application
builder.)

charliesolomon@yahoo.com wrote in article <7qq2k9$g2i$1@nnrp1.deja.com>...
> Invoke Node was exactly what I needed...however, "Make current values
> default" is not work
ing. I get an error msg saying "current state is
> not compatible with this command." I've tried using the Set State
> method to unlock or lock the VI with no luck. Any ideas? Thanks,
> Charlie
> ps - Reinitialize to defaults works great!
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 8 of 11
(6,432 Views)
As you can see, the Invoke Node has some limitations in this case,
especially with built apps. Another way of doing what you want is to save
the current default values to a file, and load them in at the start of VI
execution. If the user changes values and hits 'Save' write out the new
values to the file. If they hit 'cancel', do nothing (keep the current
values in the file). There are limitations to this approach as well, but I
find it works best for me in most situations, especially if I'm going to
build an executable. I think both approaches are valid and have there
place. You have to decide what will work best for you in your situation.

Good Luck!
Scott Menjoulet
0 Kudos
Message 9 of 11
(6,423 Views)
charliesolomon@my-deja.com writes:

> Hello ng,
> Can anyone tell me how to programatically make
> the current values of all controls on a panel the
> default values?
> Furthermore, can I set all controls back to their
> default state programatically?
>

Charlie,

Do you know about the feature in LV 5 to read and write .ini files ?
Looks like a very clean solution to me.

Johannes Niess
0 Kudos
Message 5 of 11
(6,438 Views)
All you have to do to make all your current values default values, is to set up an application reference to the current VI and then wire this to an invoke node. One of the methods is 'Set Current Values to Default'. I believe that you can use this same methode to reinitialize values to the default state.
0 Kudos
Message 10 of 11
(6,422 Views)