From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recommended program architecture


@OlivierL wrote:

The objects themselves, if they need to be accessed from multiple loops, should live in functional global VIs (un initialized shift regristers.) 

 

As for handling the update of the UI, there are different ways to handle this but the easiest is to put a timeout on your "User Event" structure and update the UI when there is no event (Event Timeout case)!

 

Olivier

 


Tnx for the reply Olivier, I will go for the solution from crossrulz though. That seems a little more deterministic.

 

0 Kudos
Message 11 of 14
(334 Views)

I'm not suggesting to do any polling here.  When the user presses a control, of course the user event should handle it.  However, if you rely only on User Events to update the GUI, then if the user does not press any button, there is no graph/indicator updates wihch is definitely not the desired outcome as teh values from your DAQ and other equipment are constantly changing.  Therefore, to update the GUI with the latest values from your instrument drivers  (running as sub VIs), you can use the timeout of the User Event. 

 

0 Kudos
Message 12 of 14
(325 Views)

@OlivierL wrote:

I'm not suggesting to do any polling here.  When the user presses a control, of course the user event should handle it.  However, if you rely only on User Events to update the GUI, then if the user does not press any button, there is no graph/indicator updates wihch is definitely not the desired outcome as teh values from your DAQ and other equipment are constantly changing.  Therefore, to update the GUI with the latest values from your instrument drivers  (running as sub VIs), you can use the timeout of the User Event. 

 


You are confusing events associated with controls with user defined events. The suggestion is to use user defined events to update the UI. The processing task will generate an event and the UI will react to it. If you use the timeout event simply to check for updates then it has become a polling loop. There are times when you need to use the timeout event to ensure some operations occur on a regular basis. Updates to the UI do not need that since you can use the user defined events to trigger an update.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 13 of 14
(321 Views)

Correct, I was confusing the terms and having an event to force the update of the UI would be more deterministic. 

 

0 Kudos
Message 14 of 14
(318 Views)