LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I ask LV to leave my design time stuff separate from runtime stuff

Made a GUI. Now I change something in code, when I stop the VI, the VI has
the looks which was last seen when I was running the VI. Is there any way
where I can configure LV so that when I am finished running the VI, it has
the same look/feel when before I clicked on the RUN button.

Same issue keeps bothering me about another thing. I have a VI, so I have
the window open on top left corner of my dual monitor setup. I run the VI
where I center it in code. When done, the LV will show the VI window at
center. Why can't it keep the thing where I had at design time. Maybe I
haven't set some options or something.



vishi
0 Kudos
Message 1 of 10
(3,416 Views)
Taking your second question first, the answer is that LV doesn't keep track of different window positions for design-time and run-time. Sorry.

Now, concerning your first question, what exactly is it that your changing and it isn't staying the same?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 10
(3,416 Views)
You choose "Reinitialize all to default" from the Operate menu, this should set most of your application back to the "original" state.

If you want to set all values back to before you clicked the "RUN" button, rather than default values, you will need to write the apps state to a file, and when you run (or quit) the application load the previous values into the controls.

Charts act a bit differently than other controls also, because they will keep their history, so you'll have to write some code to clear the history of the graph (using a property node).

For you second issue, I actually wrote a VI like that (a full screen app). What I did was record the current size of the app before changing the position / size programatically. When the user pressed t
he "quit" button, I reset the size / location of the app.
0 Kudos
Message 3 of 10
(3,416 Views)
Thanks Dave,

That's what I was suspecting. Learning every day. It is my 2nd week with LV.


vishi

"David Duffey" wrote in message
news:506500000005000000CFEC0000-1042324653000@exchange.ni.com...
> You choose "Reinitialize all to default" from the Operate menu, this
> should set most of your application back to the "original" state.
>
> If you want to set all values back to before you clicked the "RUN"
> button, rather than default values, you will need to write the apps
> state to a file, and when you run (or quit) the application load the
> previous values into the controls.
>
> Charts act a bit differently than other controls also, because they
> will keep their history, so you'll have to write some code to clear
> the history of the gra
ph (using a property node).
>
> For you second issue, I actually wrote a VI like that (a full screen
> app). What I did was record the current size of the app before
> changing the position / size programatically. When the user pressed
> the "quit" button, I reset the size / location of the app.
0 Kudos
Message 4 of 10
(3,416 Views)
I forgot to mention, you can clear a charts history by right clicking on the chart and choosing "Data operations -> clear chart history". (instead of doing it programatically.
0 Kudos
Message 5 of 10
(3,416 Views)
Mike,

For example, I have a control on a panel. Now I run the VI and in code, I
change its attributes, like position, visibility or things like that. Now
when I am finihed running the VI, the control on the panel is at new
position, not visibile and so on.

Giev another example, I have a string indicator to show Pass/Fail status.
Its color is text. Now when Fail comes, I change color to RED. Now I stop
the VI. Run next time, color is RED. I know I can write code to reset
everything at starting of VI to whatever I want, but I think it is easier if
LV did that for you. The CVI product from NI does that. Maybe its the
underlying VI architecture where state info, whether while in LV environment
or running is stored inside that VI.

I know I am biased toward
s CVI but right now I am trying to learn "how do I
do this in LV" which I do all the time in CVI. Got 2 LV books, don't help
much when you need details. This forum has been real good to get my answers.


vishi


"mikeporter" wrote in message
news:50650000000500000089EC0000-1042324653000@exchange.ni.com...
> Taking your second question first, the answer is that LV doesn't keep
> track of different window positions for design-time and run-time.
> Sorry.
>
> Now, concerning your first question, what exactly is it that your
> changing and it isn't staying the same?
>
> Mike...
0 Kudos
Message 6 of 10
(3,416 Views)
As you can tell from the other answers, there are many different ways of dealing with the two issues you raise. I'll just add a couple more comments.
1. Whenever you start LabVIEW and open VIs, the front panel controls are set to their default values and their properties (e.g. disabled, visible, etc.) are set as they were the last time the VI was saved. If you close a VI and then reopen it without exiting and restarting LabVIEW, you get the values and properties from the last time the VI was open (not the last time it was saved).
2. If you want to initialize some front panel controls every time you run the VI, you can use local variables and/or property nodes.
3. Whenever you start LabVIEW and open VIs, the front panel and diagram will be displayed at the location
they had the last time the VI was saved. If you move a front panel, close the VI, and reopen the VI without exiting and restarting LabVIEW, the front panel will be displayed at the location it had when it was last open, not last saved.
0 Kudos
Message 7 of 10
(3,416 Views)
Ok, I think I see what you mean. Actually, this in some ways is the same issue as the second question. LV keeps track of the control's current appearance, location, visibility, etc. In general, it doesn't distinguish between the way it was designed and the ways you changed it programatically.

Now here is a great big caveat: I say "In general..." because LV is 100% consistent. Some properties it saves and some it doesn't. For example, if you change the format of a plot's axis programatically and then close the VI, when you reopen it, it will be in the original state.

Bottom line, if it's critical that a control be a particular way when you start the VI up, reset it in code before the VI terminates.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 10
(3,416 Views)
Do you want to reset front panel stuff before the VI terminates or initialize it when the VI starts? Here are some technical and philosophical considerations.
1. When the VI ends, do you want the controls and indicators to show the latest values or be reset to their defaults? If you want to retain the latest values, you don't want to reset stuff before the VI ends.
2. Will you show the Abort button or a title bar when the VI is running? If yes, you don't have control over how the user ends the VI so code to reset stuff before the VI ends may not get executed.
3. Do you want the user to be able to set controls to desired values before the program starts? If yes, then you don't want to initialize when the program starts.
Generally, I lik
e to initialize stuff when the program starts and retain latest values when the program ends. But that's just the philosophical part.
0 Kudos
Message 9 of 10
(3,416 Views)
> Now here is a great big caveat: I say "In general..." because LV is
> 100% consistent. Some properties it saves and some it doesn't. For
> example, if you change the format of a plot's axis programatically and
> then close the VI, when you reopen it, it will be in the original
> state.
>

There is one property that isn't saved, but it is isn't the one you
listed. All properties of a control are saved except for the value.

Properties come in two flavors. Those which mark the VI as needing to
be saved when they are modified, and those that don't. There are
actually other distinctions since some property changes cause the VI to
be marked for recompile and others do not.

If a graph's axis is modified interactively or programat
ically and the
VI is saved, the change gets saved to disk. But, the change to the axis
will not mark the VI as needing to save since these changes are often
made simply to explore data.

Greg McKaskle
0 Kudos
Message 10 of 10
(3,416 Views)