LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Given a VI, can I determine...

Solved!
Go to solution

... if it is contained in a subpanel?  If so, how do I get the reference to that subpanel?

 

Sanks

0 Kudos
Message 1 of 5
(4,233 Views)

Hi there

 

you could check the call chain inside the sub VI. If there is no caller, the sub VI has been called from inside a sub panel. To get the reference of the sub panel you could use a FGV to pass the reference from top to sub.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 5
(4,219 Views)
No, then that means I have to store it.  Not what I was looking for.  Wanted to get the info from a VI's reference.  Thanks anyway.
0 Kudos
Message 3 of 5
(4,200 Views)

A VI in a subpanel must run as a toplevel VI so it has no callers. Use the property node "Execution.State" and check for "run top level". But you cannot know if it is really inserted in a subpanel container unless you know it will not run otherwise and you do not know if the VI is currently inserted in the subpanel container.

To get the reference of the subpanel container in your VI you can use any method of data interchange used for parallel running VIs:

- Setting the control value of  a control refnum

- Using a Functional Global Variable also know as Action Engine

- Sending through a queue

- Sending through a user defined event

Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 4 of 5
(4,184 Views)
Solution
Accepted by topic author Been bitten by LabVIEW

"waldemar.hersacher" <x@no.email> wrote in message
news:1223667606650-790553@exchange.ni.com...
> A VI in a subpanel must run as a toplevel VI so it has no callers.

This is not true. You can put the front panel of any sub VI (in use or not,
running or not) in a sun panel.

BBBL,

Sadly, this property isn't available. NI forgot to make two usefull
properties for subpanels: one to get a panel ref from a VI ref, and one to
get a VI ref from a panel ref....

One way around this is to make a smart global/ action engine/ LV2 style
global. It can have two functions: put a vi in the panel, and get a ref from
the panel... You can even make the global so it keeps a VI ref for every
panel ref that you put in it.

Another way around this is to make a panel ref control, and set it using set
control value method when you instert the vi in a panel (make a nice sub VI
for this). Then, the subvi can simply read this control. If it's Not A
Reference, then it's not inside a sub panel. Of course, if you remove the VI
from the panel, and the VI isn't finished, this doesn't work. It will only
work if the VI's in the panel quit when they are removed from the panel.

Regards,

Wiebe.


0 Kudos
Message 5 of 5
(4,144 Views)