12-17-2015 12:49 PM
Hi Mike,
My browser can't find the ude_templates repository, is there a new location for that?
12-17-2015 02:02 PM
12-17-2015 02:15 PM
Excellent, thank you!
12-17-2015 02:39 PM
@gregory
Let me know how this works. It looks interesting, but I can't pull off to mess with it right now.
12-17-2015 04:05 PM - edited 12-17-2015 04:07 PM
Regarding the DQMH: It did take me several hours over the weekend before I understood why the scripting tools actually worked. After I got the hang of it though, the scripting tools are very nice. They will make a type def of your event data, add it to the VI which registers for all of the events, add an event for it if you want your main VI to be listening for it, and more. The documentation covers everything well, and they have a nice post on their Walking the Wires blog.
Regarding Mike's post: The UDE repo has a nice document as well. If you're already familiar with events you can start to implement this strategy in 15-30 minutes. Adding a new event takes a little more "manual" labor, but still quite quick. If you are going to have a lot of events, then it does take up a bit of screen real estate to obtain/destroy them all, but you could put them all in a SubVI if that's a concern.
@Mike: Why do you create a new library for each event, rather than having a library that you just rename? (In the project explorer, not in windows explorer).
@No one in particular: So far, if I am going to send a lot of different types of data (i.e. Initialize Instrument, Setting 1, Setting 2, Begin Acquisition...) I find it much quicker to use Queues. I have a re-use library for these as well, but it requires one library per recipient, not per event. If I need the recipient to handle some new action, I add a case to a case structure and configure a typedef for the data. But, based on these champions strong approval of events, I think there is still something about them that I don't get 🙂
12-17-2015 04:37 PM
Patrick, I forgot to upload a project of what it might look like to register for events in multiple places. I'm sure Crossrulz has a nicer example, but maybe this will be useful in the mean time 🙂
12-17-2015 07:08 PM
12-18-2015 08:37 AM
Hello Patric,
Thanks for your reply. As you say, I will upload a sample code. The sample code shows the way, with which the old program refresh the value of the "State Anzeige Element", yes, with the property node, and the result data will be transfered by notifier.
The old program has already worked for more than 15 years, it has been edited by several programmer and has hundreds of cases and events. The basic structure of the old program is the "producer consummer pattern". There are also some global variable and lokale variable.
Now I rebuild the program with the Object Oriented Programming, and I have used the " command pattern" as the basic design pattern. I have to use the value from the main frontpanel in the child method. I have choosed the control reference as a solution, and I try to avoid to use the global variable. But as the crossrulz posted, the control reference will slow down the program, so does anyone have any other idea?
regards
12-18-2015 10:29 AM
I have just a couple more comments/questions about User Events.
@MikePorter: If you register for all of your events at once just outside the event structure (picture below), then the event name in the structure is the same as your event reference (and responds to changes). This seems nicer than registering for the event inside a SubVI and bundling those refnums together trying to get the names how you want them, no?
And for anyone: Where do you destroy the events? It seems a good place would be at the end of the VI that is generating the event, but I was wondering if anyone had a different preference. One use case where the Event seems simpler than a Message Queue would be stopping a program with many parallel processes. With one project I have 7 different instruments so I send 7 "Exit" messages, with the event it is just generating a single Exit event. Thank you all for your help!
12-18-2015 08:22 PM