LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The difference between adding event cases to an event structure and adding more than one dynamic event

Solved!
Go to solution

I am having a hard time understanding the difference between adding value change event cases to an event structure and adding more than one dynamic event to the ''Register for Events'' function.
When do I need to add one more than one dynamic event to the ''Register for Events'' exactly?
I am having a program where I have two event handling loops and their corresponding message handling loops, would using more than one dynamic event let me give up the other EHL and have just one for the two MHLs I have?

0 Kudos
Message 1 of 3
(1,659 Views)

@Amr95 wrote:

I am having a program where I have two event handling loops and their corresponding message handling loops, would using more than one dynamic event let me give up the other EHL and have just one for the two MHLs I have?


Assuming your event cases are fast enough to keep up with both messages, I see no reason you can't register for more event and handle it in a single loop.  This can greatly simplify your code.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(1,626 Views)
Solution
Accepted by topic author Amr95

Let's say you have two buttons on the front panel, which are handled by an event structure.

Since both buttons should trigger different actions, the structure as one case for each of them.

 

Now, a "user event" is kind of a queue with data type, which can be filled from somewhere in the code. (So, not at all "user"!)

There may be two or more events of same data type, but different desired action (like the two buttons), or even user events of different data types. Therefore, register for several user events, and have one case for each in the event structure.

 

Two hints:

  • Give a name to the constant used to create the user event. It will show up in the event structure.
  • Only events generated after execution of the "Register for Events VI" will be handled by the event structure.

Something like this is typical:

event.png

0 Kudos
Message 3 of 3
(1,597 Views)