DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Registered events as a local variable?

This is most likely not exactly DQMH related, but as I found it with DQMH this seems the right forum to ask.. 

 

The main VI of my app is based on the state machine pattern. One of the states starts up all the DQMH modules which also has the register events node. After several other cases - there is and "IDLE" case with an event structure which process the broadcasts from the modules as well as UI events. Because I cant wire the Event Registration Refnum from the register events node directly to the dynamic event terminal I thought I have two choices

  1. Using a shift register: This works 100%, the drawback is that I have to wire the refnum thru all my cases while only one of them using them
  2. Using a local variable or an FGV

 

I wanted to go with the 2nd, but I really can't because if I do this:

 

1984_0-1713510178314.png

 

Then my VI is broken because: Type Definition 'User Handler Broadcast Events': This VI cannot access the referenced item in private scope.

 

I can do this:

1984_1-1713510277768.png

 

But this means that if my modules have lots of broadcasts then the register event node gets really big, plus - even worse - if later I decide that I want to capture more broadcasts of the modules then I specifically need to add tem to the register events node and refresh the Event Registration Refnum indicator.

 

I believe this is not a bug, although its bugging me right now.

 

 

0 Kudos
Message 1 of 4
(107 Views)

Seeing as event registration references won't update and propagate changes properly even if you place them inside type definitions, we usually advise keeping that wire on the same block diagram and not wiring it into controls/indicators or subVIs.




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (The Future of Team-Based LabVIEW Development)


0 Kudos
Message 2 of 4
(77 Views)

Linked Input Tunnels make the shift register approach relatively painless:

 

Untitled.png

Message 3 of 4
(71 Views)

I don't understand why your first image throws an error but your second doesn't, as they both use the same typedef.

 

Also, your missing the trick of creating the event reg outside your loop, using invalid references, and reregistering the user events once they are valid. 

 

Edit: as I see Darren has just illustrated.  Note to Darren: you don't strictly need the shift register or linked tunnel, as the event reg Refnum is constant.

Message 4 of 4
(70 Views)