Jump to content

launching multiple vi windows of same type


Recommended Posts

Hi again,

I'm trying to get my head around this...

In response to a user request (button press) the main vi will 'spawn' a new child window which will then be able to contain a graph etc. If the user clicks the button again, a second window gets launched of the same type - able to display a graph.

I've set it up at the moment so that a new instance of a class is created on a button class and then that classes graphDisplay.vi is called, with it's front panel set to display on call. This works okay for the first button press but not after that.

Can anyone help to point me in roughly the right direction please? I'll keep looking myself and post back if I get it.

Thanks,

Martin

this is what I have at the moment.

The figmain.vi has a control on the front panel which shows the numeric value passed in - this is always right, it is just that the previous versions to not stay open.

I think I need to look at spawning a daemon (just getting my head round these after reading some examples) but then I like the idea of an OO approach.

post-13935-127602937272_thumb.png

Link to comment

You can make Object methods reentrant. If you configure the reentrancy to allow instances to be allocated dynamically, you should be able to spawn as many versions of the VI as you need. If reentrancy is something that is new to you, I can elaborate.

However, in the example you show, graphDisplay.vi runs synchronously, execution won't continue in the calling VI until graphDisplay.vi returns. Even once reentrancy is set, you still will only have one running VI showing at a time, other front panels won't be executing (might be what you want though?). If the VI needs to keep running, you'll need to create a wrapper VI that launches graphDisplay.vi asynchronously so you can have N instances of the VI spinning in memory simultaneously.

Making an asynchronous call isn't too complicated, here's a screenshot from a framework I use that does exactly that:

post-11742-127603280721_thumb.png

The key is to supply a value of 8 when opening the reference, which allocates the necessary data space and prepares the VI to allow multiple calls, then when using the Run VI method, to not wait until the VI is finished.

Does that help?

  • Like 1
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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...

Important Information

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