LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get list of event structure dynamic events

How could I get the list of all dynamic events registered in an event structure?

I need at least the names of the events as shown in the context help (e.g. "Mouse Down - My Controls" or "My User Event").

0 Kudos
Message 1 of 19
(3,978 Views)

@awilliotAcutronic wrote:

How could I get the list of all dynamic events registered in an event structure?

I need at least the names of the events as shown in the context help (e.g. "Mouse Down - My Controls" or "My User Event").


Please clarify...

 

At run time or when the VI is idle via scripting.

 

Can to provide a context where this is needed?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 19
(3,967 Views)

This is with VI Scripting. I would like to automatically create event cases in the structure based on the registered dynamic events, but I don't manage to get any information about what events are registered.

0 Kudos
Message 3 of 19
(3,963 Views)

es.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 4 of 19
(3,950 Views)

The problem is that works only if the event cases are already assigned manually to the events.

I would like to create all the cases programatically.

0 Kudos
Message 5 of 19
(3,944 Views)

@awilliotAcutronic wrote:

The problem is that works only if the event cases are already assigned manually to the events.

I would like to create all the cases programatically.


Huh?

 

You want to know at development time the event that are registered while the VI is running?

 

Please "throw us a bone" and clarify.

 

I suspect if Paul can not answer your question, "it can't be done".

 

See here were Ton showed us that dynamic event registration will let us register or re-register events dynamically at run time.

 

In the context of what he taught us, it is not possible to know ahead of time what will be registered.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 19
(3,930 Views)

No, the VIs are idle, this is for development only.

Some dynamic events are registered in a SubVI, common to a lot of structures. When these events are modified (by a developer), I want to run a script that will readjust all event structures.

For example I would like to create new event cases for all the newly registered events. So I need to detect what events are registered but are in no event case.

The optimal would be to have access to all the information that is shown in the Edit Events dialog box.

0 Kudos
Message 7 of 19
(3,918 Views)

You can get the type descriptor for the event registration refnum and follow the LV help for flattened data and type descriptors to extract the names you are looking for.

 

DynamicEvents.png

 

Ignore the unused property (DynamicTerminalLeft) it was a copy/paste malfunction.

0 Kudos
Message 8 of 19
(3,905 Views)

@awilliotAcutronic wrote:

No, the VIs are idle, this is for development only.

Some dynamic events are registered in a SubVI, common to a lot of structures. When these events are modified (by a developer), I want to run a script that will readjust all event structures.

For example I would like to create new event cases for all the newly registered events. So I need to detect what events are registered but are in no event case.

The optimal would be to have access to all the information that is shown in the Edit Events dialog box.


Hmmmm....

 

Show us your code please.

 

First issue is that registering for events in a sub-VI is a "not recommended" approach that has been discussed in a private forum that I can not link in public and many of the heavy hitters have expressed their displeasure with that condition and MAY be addressed way in the future.

 

Second is if you are registering for event sin a sub-VI and then branching the event registration wire... bad bad bad. I tis like forking a queue ref and using multiple dequeues... you can not predict which dequeue will get the new entries in a queue.

 

SO show us your code and we will do our best to guide you .... if possible.

 

Take care,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 19
(3,901 Views)

@Darin.K

That would be nice, but unfortunately the refnum TDs do not seem to be documented. I guess the Event Registration Refnum has its own TD implementation.

@Ben

- I have issues with the events being shifted when I add or remove events from the SubVI, I guess you refer to that problem. But I still prefer to keep the SubVI.

- No, the refnums are not branched. The events are registered exactly once per event structure.

- Here is an example code. The structures bundle events from a common SubVI and other events (the missing reference in the snippet is the Pane). I would like to be able to create all the event cases programatically based on the contents of the dynamic input. If a new event is added to the SubVI, I should be able to create a new case for it.

Event Main.pngEvent Register.png

0 Kudos
Message 10 of 19
(3,892 Views)