LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How Do you pass events between two Different VIs

Hi everyone
 
I have created this event driven VI....  I now want to drive the events from another VI that doesn't generate events but is static or just plain runs
 
Thank
dale
0 Kudos
Message 1 of 10
(5,087 Views)
as far as i know you can not use events from a vi in a different vi. you might want to use the front panel as your main vi
0 Kudos
Message 2 of 10
(5,057 Views)

Hi Dale,

If you want to change which VIs or controls generate events while the application is running, you can dynamically register events.  Here is a link to a Developer Zone document on Dynamically Registering Events.  With dynamic registration, you can handle events in a VI different from the one where they are generated. I'm also attaching some example code I found that demonstrates a very simple way to do this.  Take a look at the document and code and post if you have further questions!

Good luck!
Megan B.
National Instruments

0 Kudos
Message 3 of 10
(5,046 Views)
good find Morgan. that is very useful
0 Kudos
Message 4 of 10
(5,041 Views)
Way cool Megan,,,,, Just what the doctor ordered.  Will this Work on clustors as well?
0 Kudos
Message 5 of 10
(5,043 Views)
Hi Dale,
 
I'm not sure that I understand your question, but you can dynamically register events for a cluster.
 
Hope that's helpful.  Let me know if you have other questions or if I have misunderstood!
 
Megan B.
National Instruments
0 Kudos
Message 6 of 10
(5,011 Views)
Hi Again Megan
 
I guess that I am still having problems with this concept - In fact it may not be doable.  I understand that you can fire off events from the main sub  once that the subs are running.  If I am only to exicute thru the subs once and at that time want to have something exicuted within the event loop .... How can I do that?
 
Dale
0 Kudos
Message 7 of 10
(4,980 Views)

Hi Dale,

So I took another look at what you are trying to do, and I'm pretty sure that you can get the functionality you want by generating and registering User Events.  These events can be passed into subVIs where they can be triggered.  I've attached two VIs which demonstrate how to do this.

I hope this helps!!
Megan B.
National Instruments

0 Kudos
Message 8 of 10
(4,947 Views)
Hi Megan
 
I got your code snippet and I see how you do that.  I am new at Lab view and probably am not really getting into the overall architecture if you will.  So I have developed this event driven interface tool box that have within the events a section of code.   The Tool box is a standalone.  I want to use it  from a calling SubVI - as you have shown in your first example without making the sections within the event more Sub vi's.  Think of it as using the events within the toolbox.   The toolbox (SubVi) by itself stays within a loop until the user presses a finish button during standalone.   When the toolbox is called by another VI it does not get stuck!  It simply returns.  I am somewhat spoiled by using VB or C++ just to call the section that gets executed within the class or Sub.  Furthermore when I try to make the pieces within the events Sub Vi's I get a large number of inputs and outputs and a bunch of warnings "insane wires" - These are caused by the properties nodes needing to expand once they are placed into the sub vi.
 
To further complicate things when I use your first example ... I don't register changes only static conditions when only going throught the subV i once.
 
Sorry for being such a pain
Dale Pittock
Agilent
0 Kudos
Message 9 of 10
(4,938 Views)

Hi Dale,

I've read through your description of your application but I'm afraid the overall structure of your code still isn't clear to me.  I would guess that you have an architecture that would work very well in a text-based language but isn't very suited to LabVIEW.  Perhaps you could post a high-level description of how you want your finished application to work and look like.  I bet we can come up with a VI architecture that will be much simpler to work with than what you currently are using.

Best Regards,
Megan B.
National Instruments.

0 Kudos
Message 10 of 10
(4,899 Views)