LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically changing the state of a button

In LabWindows,  I want a button that when pushed stays down for a certain amount of time and then pops back up. Short of making the callback do this, is there a prebuilt control that does this already? Apparently LabView allows you to do this without having to write additional code.
0 Kudos
Message 1 of 2
(2,801 Views)

Not that I am aware of, but it should not be difficult to create it.

I would use a toggle button to do this, it will remember its state which a command button will not.

If you are using the standard callback event model already, it's just a matter adding some code to the EVENT_COMMIT section for the button in question and a very simple timer callback. When the button callback gets an EVENT_COMMIT, spawn a new asynchronous timer in one-shot mode, register a callback for it and set the callback data attributes to pass the panel and control handles to the timer callback. Then when the timer expires and the callback fires, change the state of the button and unregister the callback.

I would use a small struct like this to pass the handles:

struct
 {
  int panel_hndl;
  int ctrl_hndl;
 } control_info;

Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 2 of 2
(2,796 Views)