07-31-2020 08:02 AM
Hello!
I'm running into a problem when trying to refresh the event regisration refnum of my "main" module EHL with the events from a few different sub modules.
My main module is registering for the events of 5 other DQMH modules when it starts. After the module did it's own initialization it starts the other modules in a specific order. To not loose any events from the sub modules I refresh the event registration after the "Start Module XXX.vi" and before the Synchronize Module Events.vi" which is working as it should. But if I try to put theses functions into a few sub VI's and wire the event registration refnum to it (for a better overview) I can't to this because of the private access scope of the user event type defs.
Here is the working main VI with the sub module start and event registration in the MHL (only an example for the "Logger Module"):
main.vi
And here with the functions in a sub vi and the occurring error messages:
main.vi with sub vi
I'm not sure how to solve this problem. Changing the access scope would be a bad work around but I can't see another way to do the refreshing of the event registration without putting everything into the MHL and not in a few simple sub VI's.
Solved! Go to Solution.
07-31-2020 11:13 AM
Hi Jen,
We don't recommend putting the registration inside a subVI. The Registration reference is a special kind of reference and every time we add a new event to one of our clusters or add new registrations, we would have to replace the registration reference on the output of our VI.
Also, I personally don't like forking the event registration wire. What you are doing is not wrong, you can definitely register in the MHL loop but it leaves the code open for a newbie later forking the wire to register for another event structure and that would be bad.
What we recommend instead is creating a private user event to trigger the registration to happen in the Event Handling Loop.
Check these posts that may help you:
I hope this helps.
Thanks for your trust in DQMH and us.
Fab
08-03-2020 06:45 AM
Hello Fabiola
First of all thanks for the quick response and the things you point out 👍
I didn't thought about the fact that I have to replace the registration refnum every time I add or remove a event (that would have caused some "nice" work).
I had already thought about doing the whole thing in the EHL, but somehow I always had in mind that I have to do the registration in the MHL, which is not necessary.
So thank you very much for your advice 😉