From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control Properties

I have a VI that changes the position and visibility of various controls.  When I stop the VI and return to my front panel,
the changes to position and visibility made while the VI was running remain.  I don't want this.  I want the property states
to revert to how they were before the VI was launched.  In other words, I don't want the run-time changes to remain after
the VI is stopped.  Please help.  I'm a babe in the woods with this LabVIEW stuff, but this seems like something that should
be realtively straightforward and I can't figure it out.
 
Thanks,
Bill
0 Kudos
Message 1 of 7
(2,592 Views)
How are you stopping the VI? Hopefully with a control on the FP (e.g. a stop button).
 
Nothing should prevent you from adding some code outside the last loop that resets the control properties to the desired state.
 
0 Kudos
Message 2 of 7
(2,588 Views)

Yes, I'm using a stop button.  But no matter how I stop the VI, the runtime-modified property settings persist.  I could save the "startup" property values and restore these when I hit the stop button.  Among the cons to this approach are:

I have many controls and my VI is still a work in progress.  As I remove and add controls, this can get to be unmanageable.

This approach won't work if I "kill" the VI mid-stream during debug.

I can't believe there is not a checkbox setting in LabVIEW somewhere that says something like "run-time property settings persist" where the property settings changed at runtime persist or don't after the VI is stopped depending on the state of said checkbox.  I'm coming from a VB perspective.  Such a things seems elementary to me.

Thanks,

Bill

 

0 Kudos
Message 3 of 7
(2,589 Views)

Hi Bill,

It may seem "elementary" to you, but I would say that moving stuff around on a LabVIEW front panel during execution isn't all that common of a use case (I've actually never heard your feature request in my 7 years of LabVIEW development).  I agree that making controls visible/invisible is handy, but generally in this case, there is initialization code when the VI runs that makes everything visible/enabled/disabled/whatever, so at least when your VI first runs, it should always be in a default, expected state.

I'm curious...what kind of app are you writing where there are many controls moving around and becoming visible/invisible on the front panel?  I make no promises, but maybe there's a way to accomplish what you need without moving stuff around a lot.

-D

0 Kudos
Message 4 of 7
(2,580 Views)

Like altenbach said, you should reset the controls when stopping the program.  Do that using a sub-vi.

Now, during debugging/programming you simply call that same sub-vi at the start of the program as well.   Even when you've aborted during debugging, the default state is nicely restored.

 

I've done something similar.   In my program, I disable most of the front panel during a measurement.  Only 'cancel measurement' and 'stop' are enabled.   I have an enable  and disable front panel sub-vi.   I simply call the enable front-panel at the very start of the program, and at the end.  (No reason to remove it at the start.   It takes no time at all...  Totally insignificant to the rest of the initialization of my program)

Check the vi's I attached.  It doesn't always have to be very difficult/laberous to write...     You can get a reference to all controls, and use a loop to select certain ones by name.  (Many thanks to JaredW who showed me this approach a little while ago)

0 Kudos
Message 5 of 7
(2,564 Views)
Here's a very simple example that should get you started. (LabVIEW 7.0)

Message Edited by altenbach on 02-24-2006 02:25 AM

0 Kudos
Message 6 of 7
(2,558 Views)
Hi,


The modifications will remain until the vi is dispatched from memory, and reloaded.


So you can try to call the vi dynamically, so you can close all references, so LV has to reload it. I'm not sure if this will work, LV might be smart enough to cache the vi.


Or, like already suggested, you can read all positions etc. and put them back to there original state. You can make a subvi that gets references to all controls and indicators recursively, and another one that gets properties of an array of references, and a third that sets the properties. This way, you can reuse the functionality. You can put the results of the original properties into a smart buffer, that will only store values the first time (the original values), so you can stop the vi during debugging.


Regards,


Wiebe.



"Billy Barty" <x@no.email> wrote in message news:1140745238215-329651@exchange.ni.com...
I have a VI that changes the position and visibility of various controls.&nbsp; When I stop the VI and return to my front panel,
the changes to position and visibility made while the VI was running remain.&nbsp; I don't want this.&nbsp; I want the property states
to revert to how they were before the VI was launched.&nbsp; In other words, I don't want the run-time changes to remain after
the VI is stopped.&nbsp; Please help.&nbsp; I'm a babe in the woods with this LabVIEW stuff, but this seems like something that should
be realtively straightforward and I can't figure it out.
&nbsp;
Thanks,
Bill
0 Kudos
Message 7 of 7
(2,553 Views)