DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to refresh event registration refnum for other moduls in a sub VI?

Solved!
Go to solution

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.vimain.vi

 

And here with the functions in a sub vi and the occurring error messages:

main.vi with sub vimain.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.

 

 

0 Kudos
Message 1 of 3
(1,896 Views)
Solution
Accepted by topic author Jens_S

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:

https://forums.ni.com/t5/Delacor-Toolkits-Discussions/Module-broadcasts-registered-but-events-never-...

https://forums.ni.com/t5/Delacor-Toolkits-Discussions/What-is-a-good-method-that-is-used-specificall...

 

I hope this helps.

 

Thanks for your trust in DQMH and us.

 

Fab

 

For an opportunity to learn from experienced developers / entrepeneurs (Steve, Joerg, and Brian amongst them):
Check out DSH Pragmatic Software Development Workshop!

DQMH Lead Architect * DQMH Trusted Advisor * Certified LabVIEW Architect * Certified LabVIEW Embedded Developer * Certified Professional Instructor * LabVIEW Champion * Code Janitor

Have you been nice to future you?
Message 2 of 3
(1,869 Views)

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 😉

Message 3 of 3
(1,804 Views)