LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Registering for dynamic events on controls within a [strict] typedef

I have a strict (or non-strict, doesn't matter) typedef for a group of controls that I'll call MyTest.  I want my labview program to be able to run four MyTests in parallel, and that part is more or less working (seperate data structures and SubVIs run the test, and the MyTest typedef displays the data).

However, I'd like to not have to register events for four sets of MyTest controls by hand.  I was thinking I could somehow use the "Register for Events" VI and pass a reference to a MyTest typedef (which appears as a cluster in the block diagram) into a SubVI which would do the dynamic registration (and do this four times for each of the four MyTest), and then pass the Event Registration Refnum into another SubVI (again, four times) that would server as an external event handler.  This way, I only need to make code to register and handle MyTest events once.

However, I cannot seem to start from a reference to a MyTest and from there get references to the controls contained within.  (I can only use a property node to get the actual controls, not references to them).

Is there a way to do what I want that I'm missing or not understanding?  Or am I completely wrong-headed, and there is a better way to design things?

Thank you.
0 Kudos
Message 1 of 2
(2,473 Views)
Hi Imperfection:

As Event Structure can handle more than one case, you can add events of all TypeDefs.

When any of TypeDef controls change, the event case will give you the reference to the TypeDef changed.

You can know which TypeDef you are managing looking at it's Label property

You just have to program an state machine that selects TypeDef's label and add all TypeDef Controls to that event case.

If you have several controls can be hard to do, but for 4 can do the job.

Hope it helps,
Aitortxo.
0 Kudos
Message 2 of 2
(2,461 Views)