LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem : controls & indicators not updated when programatically open Front Panel

Solved!
Go to solution
Hi,

I have a strange problem when I want to progamatically open the front panel of a sub-vi: for some sub-vis the controls and indicatores are correctly updated while for others they are not (ie the controls show outdated values).

I have created an example here that illustrate this. The 2 sub-vis are *exactly* the same, but only one shows updated controls when I open it (with the sub-vi previously closed of course).

How is that possible?

What do I have to do to have the controls updated to the last value of the *last call* when I open the sub-vi?
0 Kudos
Message 1 of 12
(5,826 Views)
If I take your description literally, the observation is as expected:
 

1) change the controls "N points" and "power".
2) press "show graph" to display the corresponding graph.
=> The controls in sub-vi A are correct but not in B. Although
they are both exactly the same sub-vis!!!
3) close the sub-vi and start again...
You forgot to mention step zero: 0) run the VI

If you never change any of the controls "N points 2" and "power 2" (yes you don't mention changing these!), the subVI graph4.vi never gets called with any data and thus does not contain any useful data on the front panel when you show it.

Could that be it?

Message 2 of 12
(5,806 Views)
>You forgot to mention step zero: 0) run the VI

>If you never change any of the controls "N points 2" and "power 2" (yes you don't mention changing these!)...

 

mhmmm,....no that is NOT the reason... Have you tried the VI???

Honnestly, I would not bother people on this forum for such a stupid mistake.

And I also expect people to know how to run a VI....

And to play in your game, you forgot -3) Turn on the PC, -2) log in windows, -1) open labview...Smiley Wink

 

0 Kudos
Message 3 of 12
(5,793 Views)
This problem becomes more and more strange...
I have just tried my VI on an other computer and none of the 2 sub-vis Front Panel is correctly updated.
 
So my question becomes very simple:
What is the proper way to open a Front Panel with the controls/indicator updated to the last call values?
 
Thanks a lot.
0 Kudos
Message 4 of 12
(5,788 Views)

My first instict is to say "you can't".

FP of VI that are not open do not get updated. This is great because I would hate to have LV updating the FP's of all of the sub-VI I use. Talk about CPU hog.

But in your case...

If you monitor the FP.Open state and when it changes, try a an invoke node Get FP image....

That may force a screen refresh and accomplish what you are after.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 12
(5,768 Views)

titi:

Even stranger, running the example on my computer yields the same values from both subVIs. I am not sure about why you are experiencing something else on your end. Another way to get the most current value is do write all the data to a configuration file, not the best method because you will have to do a read from file at the beginning of your program and a write to file at the end.

Rudi N.

0 Kudos
Message 6 of 12
(5,751 Views)
Solution
Accepted by topic author titi_nicolas

"

So my question becomes very simple:
What is the proper way to open a Front Panel with the controls/indicator updated to the last call values?

"

I had a chance to play with this LV 8.2.1 BETA and things seem to almost make sense.

If I unzip and run your main, both VI work as you are hoping until I save the VI's. Once saved they act as I expected them to, ie no screen updates.

I adjusted your code as shown below and the sub-VI FP's get updated when run regardless of their visability.

I don't see a bug in this situation. Non-visable sub-VI FP are not supposed to update, so having to do a little extra to over-ride that is to be expected.

I hope this helps,

Ben

Message Edited by Ben on 04-10-2007 05:48 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 12
(5,746 Views)


@titi_nicolas wrote:
...
mhmmm,....no that is NOT the reason... Have you tried the VI???
...
Honnestly, I would not bother people on this forum for such a stupid mistake.
And I also expect people to know how to run a VI....
And to play in your game, you forgot -3) Turn on the PC, -2) log in windows, -1) open labview...Smiley Wink

Well, I DID run your VI and everything worked just fine, however I no longer have LabVIEW 7.1 so maybe your observation no longer applies to newer versions. It could also be because they were just upgraded as Ben noted. I did not study it in detail.

And Yes, as Ben noted, invisible VIs don't get updated for performance reasons (and not to waste extra data copies for the controls and indicators). LabVIEW is typically smart enought to update when needed, e.g. if the subVI tries to print its panel, etc.

I guess you haven't been in this forum for too long, but since controls can easily be operated in edit mode is is absolutely important to mention at which step you run the VI. (try to operate your controls with the computer turned off and you will see that it is not that easy :o). Also if you have been programming for any length of time, you should know that stupid mistakes happen all the time (at least to me and Ben :)). It is much easier to weed out the stupid mistakes with a quick question&answer than to spend hours searching for a deep and complex solution.

Message 8 of 12
(5,733 Views)

Thanks Ben, your idea does exactly what I wanted.

thanks a lot!

Message Edited by titi_nicolas on 04-10-2007 06:06 PM

0 Kudos
Message 9 of 12
(5,735 Views)

Same issue, alternate solution:

 

I have a subVI that runs frequently, and I want to show its front panel occasionally.  Adding code to the subVI that runs all the time (as explained above) is a constraint in this case.  An alternate solution would be to toggle the Defer Panel Updates property when the FP.State changes.  If the front panel state is the same, do nothing.  When "False", the Defer Panel Updates property node forces a panel update, even when the VI has not been shown.  See attached.

 

-Jason


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
Message 10 of 12
(5,391 Views)