NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

using custom UIMessages

I'm trying to develop my first TestStand (Labview version) callback, and I'm having some difficulties.  I have a TSUI.IButton on my (custom OI) front panel that I want to handle if clicked.  I tried following the steps in the NI Developer Zone document entitled, "Using Default and Custom UIMessages", but I'm running into some difficulties.  As suggested, in Full UI - Configure Event Callbacks.VI, I extended the Reg Event Callback and changed the new inputs to User Message, and wired the Application Manager to this input (I'm not quite sure why though).  Then, it says to wire a User Parameter to the User Parameter input.  As there are no other User Message events, I'm not exactly sure what to wire to the User Parameter input.  In the case of the other events, they have either Quit Application or ReDraw Event wired to their User Parameter.  And in some cases, clusters of things get wired there, and in some cases nothing is wired there.  Anyway, my Event (at this moment) is to handle a "Launch Report" button found in the Execution View.  At the end of a test, the user can click this button, and a LaunchViewer will open up a pdf file containing a summary report based on some TDM (Labview) data generated throughout the test.  I might also have other custom events I may want to handle.  So,
 
1) What do I pass into the User Parameter?  I tried a CreateUserEvent (VI) thinking that I need to pass in (to the actual Callback VI) a number somehow (UIMsg_UserMessageBase + 0, 1, 2, etc).
 
2) In the Callback VI, I thought I would use the UserParameter (assuming it was UIMsg_UserMessageBase + n) and wire that into a case statement, such that I could handle case UIMsg_UserMessageBase, UIMsg_UserMessageBase + 1, etc, as I added other custom events.  Is this not how it works?
 
3) Should I instead be passing in a cluster (into UserParameter) containing references to the various Managers, and the various Custom controls I may want to monitor?
 
4) Assuming I get 1-3 figured out, I'm not sure how the actual event occurs.  I know a PostUIMessage needs to occur somehow, but I'm not sure how to get that to happen when the user clicks the LaunchReport button.
0 Kudos
Message 1 of 5
(4,293 Views)
mrbean,
 
First of all, UI Messages are used if you want to pass any information about the current execution or the state of the engine to the operator interface. In this case, you just want to trigger some action (launch report) based on some generic event (button click). Therefore, You do not need to use UI Message. One use case of UI message is to display the content of a local numeric variable on Operator interface.
 
You may just use the default LabVIEW event structure. Or, if you really want to use the TestStand activex button, you may simple register the mouse down event of this button control. In LabVIEW Example Finder, there're two samples on ActiveX Event Callback.
 
For answers to your original questions, please refer to UsingLabVIEWwithTestStand.pdf in <TestStand>\Doc\Manuals
 
 
Regards,

Song Du
Systems Software
National Instruments R&D
0 Kudos
Message 2 of 5
(4,249 Views)
In the particular example I provided, you are correct.  I shouldn't need the UI Messages, and instead I should just use the Mouse Down event.  However, I do have two other indicators (they are actually TSUI.Labels) that, from TestStand (and maybe from within some LabVIEW source code) I want to send a PostUIMessage so as to inform the user of some things going on during the test.  So, I once again (respectfully) ask most of the original questions.  I looked at the Using LabVIEW with TestStand book, but it didn't quite provide enough detail.
0 Kudos
Message 3 of 5
(4,237 Views)
mrbean,
 
1) What do I pass into the User Parameter?  I tried a CreateUserEvent (VI) thinking that I need to pass in (to the actual Callback VI) a number somehow (UIMsg_UserMessageBase + 0, 1, 2, etc).
User Parameters are used if you want to pass information from the operator itself to the Callback VI. For example, if you want to update an indicator on the operator interface based on some UIMessage, then you need to pass the reference to the indicator as an user parameter to the callback VI. If you are going to use any User Parameters, you need to create the Callback VI after you connect them. If you do it the other way, you would get a broken wire.
 
2) In the Callback VI, I thought I would use the UserParameter (assuming it was UIMsg_UserMessageBase + n) and wire that into a case statement, such that I could handle case UIMsg_UserMessageBase, UIMsg_UserMessageBase + 1, etc, as I added other custom events.  Is this not how it works?
The actual UIMessage info should be retrieved from the Event Data terminal in the Callback VI. It's a cluster with one element called uiMsg. You can access it by using the unbundle by name node. uiMsg is an TestStand object of UIMessage class. Therefore, you can use a property node to access the "Event" property, which is the UIMessageCode associated with the UI Message.
 
In addition, you can get "Thread" as a property from uiMsg, which in turn will lead you to Sequence Context. For the relationship between different TestStand API objects, please refer to this Help document.
 
3) Should I instead be passing in a cluster (into UserParameter) containing references to the various Managers, and the various Custom controls I may want to monitor?
Yes. If you need to pass in more than one User Parameter, you need to bundle them into a cluster.
 
4) Assuming I get 1-3 figured out, I'm not sure how the actual event occurs.  I know a PostUIMessage needs to occur somehow, but I'm not sure how to get that to happen when the user clicks the LaunchReport button.
Yes, you need to call Engine.PostUIMessage to fire the event. There're also the default ones that are fired by the TestStand engine. For this LaunchReport button, you need to place the PostUIMessage method inside the block of code that's responding to a button click. If it's a standard LabVIEW button control, then you put PostUIMessage in the event structure. If it's the activex button, then you put the method in the Callback VI. I'm refering to the Callback used to handle the button click, not the Callback for the UIMessage, of course.
Regards,

Song Du
Systems Software
National Instruments R&D
Message 4 of 5
(4,225 Views)
I got the LaunchReport Callback to work.  It turned out to be quite simple.  Now I need to tackle the custom UIMessages.  Thanks.
0 Kudos
Message 5 of 5
(4,206 Views)