10-04-2012 07:35 AM
Even your own version works if you switch properly to user events and register and unregister properly.
Stop dissing LV because you don't grasp it. We can't teach anyone who won't listen.
Shane.
10-04-2012 08:19 AM
Woah. Sorry to seem to have come across as dissing LabVIEW and/or being hostile. I was frustrated because I'd been working on this problem for some time, and that came through - but I do appreciate the help. The "sorta" was because I had already looked at using a single event structure, and it wasn't really an option.
Intaris: that was exactly what I needed. Thank you 🙂
10-04-2012 08:48 AM
Having said all that, the main criticism levelled by others still apply. I simply showed you how your earlier statement that User Events didn't solve trhe problem is technically incorrect. The way you used them didn't solve the problem but whoever gave you the advice that it COULD was correct.
I would still go with a single Event structure and refactor the code but we all write bad code when we started.
If you get time, try to implement a better solution and if you post it I'll give you kudos for the learning experience, OK?
Shane.
10-04-2012 10:00 AM
@Aalenox wrote:
Woah. Sorry to seem to have come across as dissing LabVIEW and/or being hostile. I was frustrated because I'd been working on this problem for some time, and that came through - but I do appreciate the help. The "sorta" was because I had already looked at using a single event structure, and it wasn't really an option.
Intaris: that was exactly what I needed. Thank you 🙂
Then you are doing something wrong. It is a common architecture that I have used in applications orders of magnatudes more complex than what you are doing. It isn't working for you because you are doing something wrong. At the moment I can't open your VI since I do not have LV2012 installed at work. But trust what others have been telling you. The folks offering their advice are some of the top LabVIEW programmers and know what they are talking about.
10-04-2012 10:16 AM
This thread, (and perhaps some others in the past), have me wondering if there should be another king of event structure, or perhaps an option to the existing event structure.
We've all seen some instances of code, including this one, where the programmer built an architecture thinking that the event structure was only capturing events when the structure was in the current line of execution. Should there be an event type that only waits on events once the line of execution has reached the event structure? Think of it like a notifier setup where the Wait on Notification is placed where the "Ignore Previous" is set to True. Basically have an event structure where it is set that previous events are not captured or just ignored. It would probably be a bit easier to setup than using dynamic events and enabling and disabling those events.
Just throwing it out there for a bit of discussion. If there seems to be a little bit of positive feedback, then I'll write something up for the Idea Exchange.
10-04-2012 10:22 AM
@OriolesFan wrote:
This thread, (and perhaps some others in the past), have me wondering if there should be another king of event structure, or perhaps an option to the existing event structure.
We've all seen some instances of code, including this one, where the programmer built an architecture thinking that the event structure was only capturing events when the structure was in the current line of execution. Should there be an event type that only waits on events once the line of execution has reached the event structure? Think of it like a notifier setup where the Wait on Notification is placed where the "Ignore Previous" is set to True. Basically have an event structure where it is set that previous events are not captured or just ignored. It would probably be a bit easier to setup than using dynamic events and enabling and disabling those events.
Just throwing it out there for a bit of discussion. If there seems to be a little bit of positive feedback, then I'll write something up for the Idea Exchange.
I would avoid this type of structure simply because there are already better alternatives to use such as queues and notifiers. Creating this type of single shot event structure in my opinion would lead to some really ugly code and poor designs. Centralizing event processing makes one think about the overall design of the application and forces some architecture on the application. One off event structures could very easily lead to event processing scattered through the application making it very difficult to debug and maintain. Just when exactly is that single shot event structure active?
10-04-2012 10:25 AM
10-04-2012 12:24 PM
I think Mark said everything that needs to be said.
Lynn