LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Pause Button

Solved!
Go to solution

I am creating a test procedure that runs when the user clicks a "start" button on the user interface.  However, I would like to create a pause button, on the same user interface, that the user can click while the test is running. 

 

Currently, when the user clicks the start button, the functions I have made are called and the user interface is "locked" up, since the program is running in its sequential order, and any click events to the interface will not happen until AFTER the test procedure has occurred.  I am trying to figure out how to make the user interface run separately from the functions that it actually calls.

 

I have stumbled across the idea of making threads.  I do not know if that is the solution, but I have been messing around with the CmtScheduleThreadPoolFunction(); function, trying to make a function become its own thread.  

 

If the thread idea works out, I thought I could utilize the SuspendThread(); and ResumeThread(); functions.  I figured once the user could click the pause button in the middle of a test procedure, these functions could be called relative to the state of a toggle button.

 

Before I beat my face into the wall more than I need to, I thought I would see if any better minds (which I'm sure there are many) have had experience with this and know a potential direction that I should steer towards.

 

Thanks,

Alex

0 Kudos
Message 1 of 3
(2,863 Views)

Why not use GetUserEvent within your loop?

Message 2 of 3
(2,820 Views)
Solution
Accepted by topic author Alex.Pinion

I was able to the buttons on the interface for setting various flags.  Then, I made a separate thread that sits in a while loop while waiting for one of the flags to trigger.  Once the proper flag has been set "active", I run the procedure in the thread.  Not sure if this is the ideal way to implement requirements, but nonetheless, it works.

 

Thanks,

Alex

0 Kudos
Message 3 of 3
(2,790 Views)