Jump to content

Subpanel for a Call by Reference VI

Recommended Posts

I'm trying to run a VI using the Call by Reference function, then embedded it into a subpanel in my Main.VI. Once the VI is embedded, I can't use it in the subpanel. It's like everything is blocked and it won't let me interact with any of it. If I use an invoke node and call the Run VI method, this isn't an issue. Unfortunately, this is part of a much bigger application that use Call by Reference functions, so I can't replace those calls.


I have attach image snippets showing my code. Does anyone have any suggestions why this might be happening or a work-around to fix it? Thank you in advance!

Call by Reference.JPG

Open VI in Subpanel.JPG

Link to comment

Certainly what you are trying to do is possible, however SubPanels can sometimes be a bit tricky to get working nicely. Now I have all my SubPanel code abstracted away using some nice classes, but in the beginning when I was trying to get it to work properly I found it very useful to try and create as simple an example as possible. Trying to debug these kinds of things while running your whole application can be very tricky. If you create some simple examples of how your code does not work out we can probably help you figure our what is going on much quicker.

Are you sure your "Update Run Ticket.vi" is actually runnable (i.e. not broken for some reason) when you insert it into the SubPanel?

One thing to note, be careful when comparing references if you are dealing with clones. Two clones will return exactly the same reference even though they are running totally independently! In my current framework I pass the SubPanel reference into my VI when I am "initialising" it before running it dynamically, and then I have a method to allow a VI to insert itself into the SubPanel, this allows me to deal with clones as you need the actual reference of the running instance.

Also note that with SubPanels I don't think you need to worry about closing FPs before inserting them. As I said in the first paragraph try and create the most simple example you can (just two VIs!). 

Link to comment
10 hours ago, AInvisibleNinja said:


Open VI in Subpanel.JPG

I'd suggest:

  • Trying it with a VI that just runs a loop with the i terminal going to an indicator
    • OR: Set the subpanel instance to allow you to open the block diagram (right click option) and then open the VI at runtime, verifying that its actually executing correctly -- maybe it got stuck and thats why everything is unresponsive
  • Checking to see if the variant to data function is producing an error or warning. I seem to recall labview not liking to convert strict VIs into generic VIs
    • It looks like you are closing the VI front panel? Sometimes that can cause a VI to stop as well
Link to comment

Okay, so I tried the test case that you mentioned and it seems like once the VI shows up inside of the subpanel, it stops running. I also already tried opening the block diagram of the VI running in the subpanel but it won't actually let me open it despite have the option selected.


I also know that there is no error being produced by the variant to data function. Closing the front panel could be the issue though. I'll look for where it's being opened and seeing if I can stop it there and see if it helps. Thanks!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By MikaelH
      I have an issue with a Sub Panel in a generic GUI VI we use as part of our company's OO based application framework.
      Most often the SubPanel behaves like it should.
      But sometimes after the application has stopped, the VI that was last inserted into the SubPanel, is still inserted according to LV.
      When this happens (and I start the application again) I can't insert that VI into the SubPanel again, I can insert other VIs, but if I try to insert the last Inserted VI, LV says:
      Error 1145: Cannot open VI because it is already in a subpanel control.
      If I try to open the VI's FP, LV opens the FP of the GUI VI that has the SubPanel (just like it should if it was inserted), but the SubPanel is Empty.
      And LV behaves the same, even after the SW stopped?!?!
      When LV stops all SubPanels should be emptied (i.e.all inserted VIs should be thrown out.)
      Has anybody else experienced this strange behavior?
      Our framework is doing something that LV doesn't like of, but I haven't figured it out yet.
      We do see one strange behavior as well.
      We start up the framework with a VI that kicks off some processes (just like you do in Actor Framework), and when the framework starts up and starts inserting stuff in the SubPanels, the Top VI becomes broken, but it's still running.
      Have you guys seen this as well?

    • By John Lokanis
      I am running into an issue where my VI Server connection goes stale after a few hours.  Looking for a fast way to detect this and recover.
      Currently here is what I am doing:
      On first call, open the application reference and then open the VI reference.  Cache both of these.  Use the VI reference to call the remote VI. On subsequent calls, test the cached references to verify they are still valid and then call the remote VI. What appears to be happening is the references still appear to be valid in the caller but the connection is broken so the remote call fails.  Then I detect this and reopen the app and VI refs and can again call the remote VI.
      The issues are:
      The failing remote call takes a long time to timeout and I do not see how to control this timeout. The test of the refs does not actually test to see of the network connection is still good. The result is it takes a long time to recover and this is upsetting the user since it appears the system is locked up.
      What I need is a way to control the timeout of the 'call by reference' node or a way to quickly test the references to verify the network connection is still good before I attempt the remote call.
      Any ideas?
    • By RnDMonkey
      I see a lot of knowledgeable minds around here, so here's my challenge. I have a test system that will have, at the user interface level per channel, 3 inputs and 2 outputs that together encompass a simple test scenario. I would like that scheme repeated up to 10 times in a single application so you could watch a bank of units under test, allowing both scripted or manual manipulation of inputs; plus viewing and logging of the outputs.
      Here is an example of what I think I want the user to interact with:

      I would like to associate each of these "subpanels" (not to be confused with actual subpanels - yet) with a LabVIEW class object that will handle the interface with hardware. All channels would be coordinated by a top-level VI (let's call it the Controller) that aggregates the channels and provides the ability to parse script files to press buttons and stuff. Here's where I'm having trouble, conceptually. One solution seems to be to spin off a new asynchronous call-and-collect VI (in the form of the pictured panel as a brat VI) that has the brat throw its control references into a queue for the Controller to catch and store for later access. The brat would receive stuff like a user stop event and the hardware session's class object when first called. I would then create an array a grid of 10 Sub Panel controls on the Controller's front panel and place each brat VI into its own Sub Panel like a facade.
      The core of the hardware IO would be built into the brat VI (operating on the class objects), with the Controller pulling the strings and catching outputs and user interaction through dynamically registered events and property nodes operating on the brat's references. This all seems like it should all be workable and isn't fundamentally new to me.
      Does this seem reasonable?
      Another - much less (in)formed - concept I had was to avoid the ACBR brat structure entirely and implement this "subpanel" as an XControl that I can treat like a regular control on my Controller's front panel. I think of XControls because I can't have a cluster with both inputs and ouputs (unless I access the indicators with property nodes and fake it, I think), though I am actually only assuming that XControls allow both at once, or the equivalent behavior. In this scenario, the controller would retain an array of my hardware session's class objects and index them associated with each control. This way, the controller would invoke a hardware IO operation in a for loop to iterate across all devices. Similarly, when one of the XControls had a button clicked, the controller would see the value change event, figure out which one fired it, and do some function for only that associated hardware.
      I've never implemented an XControl before - at all - so the first solution is going to be the easier one for me. Is there a good argument for going the XControl route over the asynchronous-brats-with-Sub-Panel route?
      Thank you for your inputs, and sorry for the wall of text!
    • By ensegre
      I ran into this; I wonder if I'm misunderstanding, or it's a bug.

      I have a FP, with buttons I want to toggle with keys, and I have string controls in a subpanel, like in the attached minimal example. I'd like to toggle the button while the focus remains in the subpanel string. While this is no problem for a control on the FP, pressing F1 while focus is in the subpanel string rises the focus to the whole subpanel container. What is wrong? If a bug, how to workaround? Setting KeyFocus to the sbubpanel string ref doesn't seem to help.
      Seen in 2014SP1 linux and 2014SP1f3 windows.
    • By Manudelavega
      Is there a way to retrieve the reference of the VI inserted in a subpanel? I'm writing a code that takes a "parent" VI ref, and then scan through all its splitters, panes, and subpanels, and now I'd like to retrieve some infos from the VIs loaded inside the subpanels...
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.