NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

User Message event firing

I'm not sure of the best way to program what I have in my head.

 

If I send a UI Message >10000 then the User Message event is going to fire for any and all of those messages.  This isn't much of a problem if it is a single callback VI that has a case structure to handle the different event numbers.  This is what some of the examples are showing in the Developer Zone.  My problem is that I will have several different VIs that will be handling User Messages.  If I want to keep the same Reg Event Callback structure is the only real way to do this with different VIs is to register multiple callback VIs to the same event and just have each VI only respond to the event number that it is interested in?  It seems to be a bit of a waste of CPU cycles if I have 5 different callback VIs and and 4 of them will get pinged on every event but not actually do anything.  I'm not going to be firing these messages too rapidly (~0.5-1s) but I can just envision one of my other programmers running a little wild with this concept and then we eventually find out that LabVIEW starts to get finnicky having 20 different VIs registered to the same event even if only 1 of them will do anything for any given firing of the User Message.

 

0 Kudos
Message 1 of 4
(3,388 Views)

Ok, so I just tried to code up registering two callbacks to the same event and I get a LabVIEW error that this isn't possible.

 

Thoughts on the best way to do this without having to poll for the UI Messages?

0 Kudos
Message 2 of 4
(3,385 Views)

Hi,

 

You might call the AEs about registering multiple VIs. I don't know if that is possible. I've never seen it.

 

What is the problem with a single callback VI that has a case structure to handle the different event numbers? Can't you paste your several different VIs into the case structure? Do you have to process your events in parallel, are they overlapping, or can you process them all serially? That's the only reason I can think of to not use the case structure.

 

You can use the single callback VI case structure to convert the TestStand User Events to LabVIEW Dynamic Events and pass them to the LabVIEW Event structure that the Exit Event is in. And then put your VIs in the Event structure. Basically what that does is make the single callback VI a router that forwards the event messages to another handler. 

 

cc

0 Kudos
Message 3 of 4
(3,376 Views)

@CoastalLabVIEWER wrote:

Ok, so I just tried to code up registering two callbacks to the same event and I get a LabVIEW error that this isn't possible.

 

Thoughts on the best way to do this without having to poll for the UI Messages?


Why not just have the main UIMessage handling VI call whichever other VIs you want to call when their corresponding messages are fired?

 

-Doug

Message 4 of 4
(3,355 Views)