MartinMcD Posted June 8, 2010 Report Share Posted June 8, 2010 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. Quote Link to comment
mje Posted June 8, 2010 Report Share Posted June 8, 2010 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: 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? 1 Quote Link to comment
MartinMcD Posted June 9, 2010 Author Report Share Posted June 9, 2010 Thank you very much, that's a massive help. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.