NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

User Interface tracking of a StationGlobals or FileGlobals variable change.

Wanting to add an indicator (LED or Button) to a C# User Interface for TestStand that shows the state of a StationGlobals boolean (or FileGlobals) and the indicator changes when the boolean changes during execution of a test program.  Is there a way to track a StationGlobals variable state change like this (other than reading the variable every n milliseconds)?  Example code?

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

Rather than use a global, you could instead use a UIMessage. Your sequence would need to call Thread.PostUIMessage() (I recommend posting it synchronously - there's a parameter for this). You can use a message code UIMsg_UserMessageBase or higher, or use Engine.RegisterUIMessage() to generate a unique message code for your custom messages. Then in your UI you can handle the UIMessage event of the application manager to get the ui message and respond to it by changing the state of your led. See the API help for more info.

 

Hope this helps,

-Doug

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

Hello,

 

You may want to check out the following article on UIMessages.

 

Using Default and Custom UIMessages

http://zone.ni.com/devzone/cda/tut/p/id/4532

 

 

Regards,

Shawn S. | NIC
Instrument Driver/IVI PSE
National Instruments
0 Kudos
Message 3 of 3
(2,958 Views)