LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple event structures

Solved!
Go to solution

Experts,

 

Any adverse affect of having two Event Structures, one in the main BD handing UI events (button presses, menu items etc), another running in a looping subVI handling User Events?

 

My reason for doing so is otherwise all blocking UI calls (like brining up a password entry dialogue) cannot be handled directly in the Event Structure. I am using User Events (and so a corresponding Event Structure) as the basis for a periodic task scheduler, and my tasks get queued and not handled properlyif anything blocks the Event Structure.

 

Of course I would be careful that there would be no common events between the two structures. This would be made easier due to the subVI nature of the User Event handling Event Structure.

 

Thoughts?

0 Kudos
Message 1 of 8
(13,891 Views)

@nrp wrote:

Experts,

 

Any adverse affect of having two Event Structures, one in the main BD handing UI events (button presses, menu items etc), another running in a looping subVI handling User Events?

 

... 

Of course I would be careful that there would be no common events between the two structures. This would be made easier due to the subVI nature of the User Event handling Event Structure.

 

Thoughts?


 

Sounds good to me.

 

The "no common ..." disclaimer rules out filter events fighting.. so go for it.

 

 

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 8
(13,883 Views)

I have implemented this and it seems to be operating exactly as before (i.e. really well) except now I can have blocking UI events (which are not common, but do exist).

 

Designing all simple pop-up dialogues to not pause the operation of running loops is an interesting task...

 

Smiley Very Happy

0 Kudos
Message 3 of 8
(13,854 Views)
Solution
Accepted by topic author Neil.Pate

Nothing inherently wrong with having multiple event structures. Our application tend to have dozens upon dozens running in parallel, due to the fact that User Events, while requiring a bit of wiring and infrastructure, are incredibly useful things.

 

The main caveats are:

  1. If you register for a User Event, don't wire that same Event Registration Refnum to more than one Event Structure, or the behavior is undefined. Sometimes one or more of the event structures won't receive the event. Instead, register the event multiple times, one for each event structure.
  2. As Ben said, don't register for the same Filter event more than once.

Another easy way to get around the blocking dialog problem would be to create another loop whose sole responsibility is to pop up blocking dialogs. You could use a queue or user events or whatever to send messages to and from this loop. One loop should be enough, especially if the pop ups are modal and only one could be active anyway. To be honest I've never had to do this, but it seems like it would work fine.

Jarrod S.
National Instruments
0 Kudos
Message 4 of 8
(13,814 Views)

Hallo Experts!

 

Even i have the similar situation.

 

please find the attached VIs.

 

i have a main VI which has event structure and another subVI which is also loaded in the subpanel of the main VI.

can i use event structure like in the subVI , if the subVI handles only small operations, bundle, unbundle etc?

instead of the subVI in the example, i have to use some dynamic dispatching methods. and i dont want to run the subVi in parallel to some UI, send msgs using events, queues etc.

does this solution ok? or any other suggstions?

 

Thanks a lot

RENN

LV2010SP1

Kudos always welcome for helpful posts 🙂
0 Kudos
Message 5 of 8
(13,297 Views)

Is there any problem to use more than event structure in single VI ? 

0 Kudos
Message 6 of 8
(12,539 Views)

@kumuch wrote:

Is there any problem to use more than event structure in single VI ? 


Read the help for "event structures."  Particularly, the "caveats and recommendations for using events" section.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 8
(12,520 Views)

@kumuch wrote:

Is there any problem to use more than event structure in single VI ? 


No.

 

(You can even have mutiple event structures react to the same control. Her is a simple example ).

 

You should make sure that all event structures are ready to react at all times, so each should be in it's own, independent toplevel loop. Event structures should never be buried inside case structures, sequence structures, or other event structures. Event structures should not contain lengthy or interactive code (such as while loops with stop controls). 

0 Kudos
Message 8 of 8
(12,512 Views)