12-21-2015 04:34 AM
Hello Crossrulz,
can you give me a sample code for this benefit "Another benefit of the User Event is that you may find another process that needs that data and all you will have to do is register for that User Event. Every place that is registered for the event will see it"
regards!
12-21-2015 06:02 AM - edited 12-21-2015 06:07 AM
alre wrote:
can you give me a sample code for this benefit "Another benefit of the User Event is that you may find another process that needs that data and all you will have to do is register for that User Event. Every place that is registered for the event will see it"
Here is a snippet showing the function. I have plenty of applications that actually use this. The easiest example I can think of is I have a module for reading data from an instrument. I have another module that processes that data for whatever the application needs to do with it. Along comes a requirement to log all of that read data. So I have to make a logging module. Since I used User Events, I do not have to create another resource for passing the data. I just register for the Read Data Event and log it when I get the event.
12-21-2015 06:10 AM
gregoryj wrote:
And for anyone: Where do you destroy the events? It seems a good place would be at the end of the VI that is generating the event, but I was wondering if anyone had a different preference. One use case where the Event seems simpler than a Message Queue would be stopping a program with many parallel processes. With one project I have 7 different instruments so I send 7 "Exit" messages, with the event it is just generating a single Exit event. Thank you all for your help!
Depends on the purpose of the event. But most commonly, I destroy the event as the very last thing an application does.
12-21-2015 07:34 AM
Thanks! I have understood
03-07-2016 09:59 AM
me too