LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you share FP Controls between different Event Structures

I'm creating a program that will either read real-time data from an VNA on the GPIB bus, or read a saved s2p (Agilent) file and analyze it. The FP consists of 5 graphs, and various controls which handle events like printing, changing filters, or exiting. on the BD I have a case structure controlled by an operator selection pop-up. I tried using the same FP controls in the event structures I have setup in each case, as only one event structure would ever be executing at any given time, but the program doesn't seem to like it ast run-time. I've worked around the issue by creating "duplicate" controls and using the property setting to make them visible/disabled, etc., but the is seriously congesting my BD.

 

Anyone know a way to share controls with seperate event structures?

0 Kudos
Message 1 of 4
(2,203 Views)

Hi,

 

When you create an event structure that has certain events in it, it registers those events, and will queue them up even if that event structure is not being called or as you said 'in-use'. A better idea is to try using something like a producer/consumer design pattern and have your event structure in your producer loop. Then you determine based on your system state how exactly you want to process those events, but you can send commands to your consumers to handle the front panel events. This means you will only have a single event structure handling your UI.

 

Regards,

 

Jeff Peacock

 

Product Support Engineer | LabVIEW R&D | National Instruments  

0 Kudos
Message 2 of 4
(2,193 Views)

It sounds like the root problem is the overall structure of your program. I highly recommend that you check out the Queued Message Handler project template in LabVIEW 2012, that will show you how to utilize a single event structure and pass events to a consumer loop. If you program is too large to consider an architecture change at this stage of the game, then there is a workaround for your problem.

 

What is most likely happening is that you have the event structures all set to lock the front panel until the event completes. However the case structure that you have wrapped around these event structures is causing all but one of these event structures to be unreachable thus preventing you from handling the event. Again, as I stated above, the "RIGHT WAY" to fix this is to select a better program structure but the "kluge work-around" fix is this: Dynamically register for the value change event on all of the controls you are trying to trap events for. Dynamic events can be deregistered and re-registered at run time. This will allow only the event structure in the active owning case structure to be registered for the events, thus no other event structures will get in your way.

 

Disclaimer: This advice is given based on very minimal information and a great deal of speculation and may not be correct. Please include your code if you need further assistance.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 3 of 4
(2,190 Views)

Agreed - change the architecture. Or try this, just be careful about how you stop each loop:

multiReg.png

0 Kudos
Message 4 of 4
(2,181 Views)