I'm struggling to create a way to monitor the TestStand buttons in LabVIEW's simple OI Login/Logout specifically (TSUI.IButton). Would anyone know of a way to do this? I would really like to find a way to have these buttons be some sort of event that I could monitor with an event structure.
My end goal is to simply show the current user on an indicator placed on the OI and then be able to refresh the indicator everytime a user logs in or out.
Solved! Go to Solution.
The best way to do this is to do it within TestStand, and limit the code in the OI to just handle the event and then display code. The buttons cause a sequence called LoginLogout to fire, it's in C:\Program Files\National Instruments\TestStand 2012\Components\Callbacks\FrontEnd\FrontEndCallbacks.seq. I think what I'd want is a UIMessage to be posted to the OI. The OI will then handle the UIMessage to get the ID of who is logged in. Looking at the UIMessageCodes Enumerations in the TestSTand Help. I don't see a UIMessage that the TestStand engine fires automatically upon login and logout. You could add your own step in LoginLogout that uses the PostUIMessageEx method to post a message in the UIMsg_UserMessageBase range, then register for a callback in the OI that gets fired when the PostUIMessage happens. You can put the logged in ID in the UI Message, or in your registered handler VI in the OI, you can get a ref to Sequence Context and then use a lookup string to read who is logged in.
Sounds simple right? 🙂 Start by putting a breakpoint in the LoginLogout sequence to check it out. Also experiment with UI Messages. The TestStand II Course has an example of how to post ui messages and handle them in the OI. If you do edit the LoginLogout sequence, you should first copy the FrontEndCallbacks.seq and paste a copy in TestSTand public components. It will then override the copy in TestStand root, but leave it intact in case you want to revert to default. C:\Users\Public\Documents\National Instruments\TestStand 2012\Components\Callbacks
There may be other ways to do this. For example StationGlobals.TS.CurrentUser.LoginName always exists, but you'd have to poll it, or you'd still need the login/out event to alert you to a change.
You just have to use connect caption. I have edited the Simple LabVIEW OI. Use a Label control or something similar from the TestStand palette and connect it like this in Configure Application Manager.vi. Pass the reference from the main vi and voila you are done.
This is exactly what I'm looking for, it worked perfectly, thanks a bunch 🙂