LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI timing influenced by mouse actions

Solved!
Go to solution

Hello everyone,

I have noticed in my application, that selecting a numeric control field (or simply moving the mouse over a control or a chart indicator) changes the timing of the application. Is there a way to disable this, to get a more repeatable timing?

Example below, when selecting the “0” in Numeric:

Jascha_Eisenberg_0-1677571053180.png 

Jascha_Eisenberg_1-1677571089168.png

 

I found an old forum entry about this and was wondering if there is a better solution available than using a transparent decoration to cover the entire user interface.

0 Kudos
Message 1 of 11
(1,617 Views)

Provided that you can't guarantee a constant timing unless the OS is realtime, you can improve greatly by running the code in another "worker" vi with no user interface. This vi may send the results of the processing to other vis - to be viewed or saved - using a queue or a notifier or whatever you think is best for your application. A proper way to terminate or pause the worker vi should be setup, via a Global, a Notifier, a User event, a command queue or other synchronization objects.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 11
(1,605 Views)

Thank you for your reply. What do you mean with a "worker" VI: a sub-VI?
The same timing happens if the loop is run in a sub-VI: If the Numeric on the caller is selected, the timing in the sub-VI is influenced.


My application is a Queued Message Handler.
Left: Caller,    right: sub-VI

Jascha_Eisenberg_0-1677573379433.png

 

0 Kudos
Message 3 of 11
(1,596 Views)

I meant a vi run in parallel with your main. But your subvi has a user interface that it constantly updates. This forces running in the UI thread and this could be the reason of the jitter.

I'm trying to replicate your test but I don't get the same bad results. I get timings from 10 to 12 whether or not I move the mouse or select the numeric. If I drop the chart, I get 10 to 11 (very seldom 12).

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 4 of 11
(1,578 Views)

Why do you need it? Don't do timing sensitive things in the UI thread and if timing is really important, do it in a RT OS.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 11
(1,561 Views)

Thank you for your responses. How do I get the process into the UI-Thread?

My demo-application now uses two loops (and I changed the execution setting), but still get the same interference from the mouse over the Numeric indicator from the main-VI in the sub-VI:

Jascha_Eisenberg_0-1677579762434.png

Main:

Jascha_Eisenberg_1-1677579784148.png

Sub-VI:

Jascha_Eisenberg_2-1677579798007.png

 

0 Kudos
Message 6 of 11
(1,555 Views)

Hi Jascha,

 


@Jascha_Eisenberg wrote:

My demo-application now uses two loops (and I changed the execution setting),


Don't even start to fiddle with execution priorities of subVIs. Most often this setting will not improve the behaviour!

 

Switching the execution system does not help here as all FP elements are handled in the UI thread: as soon as you interact with the "Numeric" control your VI will be limited by the UI thread execution…

 

Again: Don't do time-critical stuff in a loop which is supposed to handle UI elements. (See previous responses above…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 11
(1,545 Views)

If I have two loops, and I select the “0” in the numeric control (top loop), why does it influence the timing of the lower loop?

Jascha_Eisenberg_0-1677582205427.png

Jascha_Eisenberg_1-1677582214110.png

 

 

0 Kudos
Message 8 of 11
(1,537 Views)

I tried by changing the timed loop to just queue up the times in a sub-vi but it had the same effect. So, back to the original question, why do you need a timed loop? It it's some sort of sampling it should be hardware timed and you should get it in chunks.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 11
(1,514 Views)
Solution
Accepted by topic author Jascha_Eisenberg

Hi Jascha,

 


@Jascha_Eisenberg wrote:

If I have two loops, and I select the “0” in the numeric control (top loop), why does it influence the timing of the lower loop?


Because there only is one UI thread!

When the UI thread is busy with your "numeric" then it cannot serve the chart (which requires UI thread work) in the other loop at the same time…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 11
(1,505 Views)