LabVIEW Freezes When Clicking or Holding Front Panel

Updated Nov 2, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • Whenever I click and hold the Front Panel window of my LabVIEW VI, the Front Panel objects freeze and stop updating for about 0.5 seconds. Why does this happen?
  • If I hold down a Front Panel object on my LabVIEW Front Panel, indicators and controls stop updating. How can I prevent this?

Solution

This is expected behaviour and is caused by the way LabVIEW handles User Interface (UI) interactions.

All UI events (including control and indicator updates, mouse clicks, window movements etc.) are handled by LabVIEW's UI thread. Each event is queued in the UI thread and handled sequentially. Therefore, when a new UI event is triggered (such as holding the Front Panel window), updates to Front Panel objects are delayed until the UI event has been processed.

Note: Block Diagram execution may also appear to freeze if the code is handling UI events like writing and reading values to Front Panel controls and indicators.

To mitigate this issue, consider making the following changes to your code:
  • Structure the code based on the Queued Messaged Handler (QMH) architecture.
    • This architecture uses a Producer/Consumer-like structure to queue UI events. The event can be queued along-side the value of a control or indictor. The event is then processed in a Consumer loop, and updates to controls and indicators are stored inside a Cluster. This ensures that all UI events are handled in a dedicated case.
    • Refer to Using a Queued Message Handler in LabVIEW to understand the concepts of QMH architecture.
  • Use a Functional Global Variable (FGV) to store updates to controls and indicators.
    • Reading and writing values directly from Front Panel objects or using local variables will be handled inside LabVIEW's UI thread.
    • To minimise the utilisation of the UI thread, store Front Panel object values in an FGV instead.
    • Refer to Functional global variable (FGV) to understand how to implement an FGV.

Additional Information

Any LabVIEW task that updates Front Panel controls and indicators will occur inside the UI thread. Therefore, regardless of the medium used (i.e. local variables, global variables, Property Nodes etc.), every update is processed in the same thread.