LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How best to decouple the UI in the LV 2012 Queued Message Handler Template?

Solved!
Go to solution

If you create a new "Queued Message Handler" from the new LV 2012 Template, you'll see a blue box in the "Update Display" case which says the following:

 

Code Recommended - If you wish to decouple the Message Handling Loop from your user interface, consider creating User Events (like the "Stop" event in this VI) to message the Event Handling Loop whenever the user interface needs updating. 

 

I'd like to give this suggestion a shot but I'm struggling to find the best way to do this and still keep the code modular.  The template creates a "User Event - Stop.lvlib" with Create/Destroy/Fire SubVI's.  I would like to create a similar "User Event - Update UI.lvlib" library with similar Create/Destroy/Fire SubVI's to keep this new user event separate and modular.  The problem I'm hitting is that there can only be one Dynamic Event Terminal in the Event Structure so how do I modularlize creating user events into separate SubVIs and still maintain this one Dynamic Event Terminal?

 

As a follow on question, would it be best to have one user event library per indicator that needs updating or just one single UI update user event and then pass a cluster as the message which contains the name of the control to update (to be used with a case structure) and then the data to go along with it?

 

Thanks!


0 Kudos
Message 1 of 2
(2,528 Views)
Solution
Accepted by SeanDonner

Instead of having the Register Events in the "Create Methods" you could do that part outside your "create" SubVIs and then simply bundle them. Then you create your individual User Event handling. See snippet where i created a "Create User Event - Update" vi in front of the Stop.

 

user events.png

0 Kudos
Message 2 of 2
(2,506 Views)