Jump to content
Sign in to follow this  
Clara Merino

Passing Data To A Subpanel

Recommended Posts

Hi,

I'm building an application in which I would like to use subpanels. Up to now I've only been able to open the FP of the SubVIs called and, then, give values to the inputs but once loaded in the subpanel container. Is there any way of passing values to the inputs so that the SubVI starts running directly when called?

Thanks a lot,

Clara

Share this post


Link to post
Share on other sites

I am curious to know how you are passing data to the sub-paneled VI right now?

In any case, to pass data to a VI control before launch you can use the VI Server Method Set Control Value. I have attached an image that shows how to do this before running and embedding the VI.

post-15-1075840972.gif?width=400

Share this post


Link to post
Share on other sites

Hi Clara,

There is a more direct route to accomplishing what I think you are looking to do. The attached image should get you up and running.

  • Create a "Call by reference Node"
  • Right click on the Call by ref node and select "VI Server" and then "Browse"
  • Select the VI that you are looking to throw in the sub panel
  • Right click on the reference input of the Call by reference node VI and create a constant
  • Disconnect the reference from the input and wire it to the input "Type specifier" of an "Open VI Reference" vi
  • Wire the vi reference of the open vi reference Vi to the Reference input of the Open by Type Specifier
  • The Image attached should show you the rest.

This solution requires you to learn a little about using the call by ref node if you don't have prior experience with it, but it is the most straighforward and clean way to accomplish sending inputs to a vi you are opening in a sub panel :thumbup:

Share this post


Link to post
Share on other sites
Hi Clara,

    There is a more direct route to accomplishing what I think you are looking to do. The attached image should get you up and running.

  • Create a "Call by reference Node"
  • Right click on the Call by ref node and select "VI Server" and then "Browse"
  • Select the VI that you are looking to throw in the sub panel
  • Right click on the reference input of the Call by reference node VI and create a constant
  • Disconnect the reference from the input and wire it to the input "Type specifier" of an "Open VI Reference" vi
  • Wire the vi reference of the open vi reference Vi to the Reference input of the Open by Type Specifier
  • The Image attached should show you the rest.

This solution requires you to learn a little about using the call by ref node if you don't have prior experience with it, but it is the most straighforward and clean way to accomplish sending inputs to a vi you are opening in a sub panel  :thumbup:

Norm and Clara,

:!: I discovered a bug during beta testing, which is caused by calling the CRB and SubPanel methods in parallel (as done in your example, Norm). This has been fixed (I hope), but it is probably better to 1st call the SubPanel method and then invoke the CBR node. You can take a look at the attached example to see what I'm talking about and to test whether the bug is really fixed.

Regards,

-Jim

Download File:post-15-1075853833.zip

Share this post


Link to post
Share on other sites
You can take a look at the attached example to see what I'm talking about and to test whether the bug is really fixed.

Well, I tried it out and it seems to be fixed. :thumbup:

However there is a place for both implementation methods. I usually use sub-panels as part of a larger user interface approach. I prefer my sub-panel call to be non-blocking so my caller can go about it's business. This is why I prefer the VIServer implementation. However from an ease of use standpoint the call by reference is much better.

Share this post


Link to post
Share on other sites
Well, I tried it out and it seems to be fixed.  :thumbup:

However there is a place for both implementation methods. I usually use sub-panels as part of a larger user interface approach. I prefer my sub-panel call to be non-blocking so my caller can go about it's business. This is why I prefer the VIServer implementation. However from an ease of use standpoint the call by reference is much better.

Michael,

I agree with you that both the CBR node and the Run method have thier place. Same thing with synchronous vs asynchronous SubPanelled VI calls (Run method can be either blocking or non-blocking depending on the "Wait until done" argument). However, I was simply referring to the fact that the two primitives (CBR node and SubPanel method) should not be called in parallel, since this causes a race condition that LabVIEW has already choked on (at least in Beta). I looked at your example, and you are forcing these primitives to execute sequentially (via data flow), so you're OK :thumbup:

Cheers,

-Jim

Share this post


Link to post
Share on other sites
I am curious to know how you are passing data to the sub-paneled VI right now?

Well, now I don't pass any data to the SubVIs, that's the point. What I was doing was calling them from the subpanel and then setting the input values by hand... But this is of little use for my application and that's why I asked :)

I will try using the Call by Ref method... Thanks a lot to all of you!

Ciao,

Clara

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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