Timed functions in CVI GUI

406 Views Asked by At

I'm working on an application in Windows CVI that needs to run some code for a series of time intervals set by the user via text entry boxes. The boxes include three for how long to run each process, one to show the total time the processes will take, and one to show the time remaining.

My implementation currently is to have a function with static variables to track which process is running and how long is left in the current process, then move on when that time has elapsed. This function triggers on pushing a start button. Unfortunately, the code stops on the click of the start button as it seems to be waiting for the code to finish executing before it allows any further inputs.

Is there a "right" way to do this? Maybe something with multithreading or a pre-built timer application?

1

There are 1 best solutions below

0
On BEST ANSWER

Got an answer here: "You are on the right way speaking about timers: place a timer control on your panel, set it to disabled, put your code in the timer callback and run the program. When the user inputs the required time, set the ATTR_INTERVAL attribute of the timer to this value, next enable the timer with ATRT_ENABLED attribute and you'll have your timed function up and running!"