07-09-2010 02:07 PM
I am utilizing UI Messaging with a custom LabVIEW UI. One of my UI elements is a tree control that contains the UniqueStepID and status.
To update the status tree control, I would like to send the UniqueStepID along with the Status from:
1. SequenceFilePreStep Callback
2. Pre-Expression
3. SequenceFilePostStep Callback
The statement I am trying to use is below:
RunState.Thread.PostUIMessageEx(UIMsg_UserMessageBase,1,RunState.CallingStep.UniqueStepId,RunState.CallingStep.ResultStatus,True)
When I attempt to use the Variant to data error on the ActiveXData, I get an error.
1. What is the difference between running the PostUIMessage in an ActiveX step vs Expression/Statement? (other than backwards compatability)
2. How is the activeXDataParam used with a LabVIEW callback (any examples)?
07-12-2010 02:50 AM
There should not be a difference between calling PostUIMessageEx from a dedicated ActiveX Action Step or from an expression.
In my opinion, you are using the ActiveX param in a way which is not the main focus. The focus of ActiveX param is to enable the user to pass information about the TestStands execution dataset. So in most situations, you will simply pass the SequenceContext (namely ThisContext from TestStand execution) and use the Get/Set Property Value from the TestStand API.
Since the ActiveX param is a variant, you will need to cast the variant to the SequenceContext first. You can find the control SequenceContext in the control palette (frontpanel) TestStand >> Legacy.
hope this helps,
Norbert
07-12-2010 09:06 AM
You need to use the Variant to Data node in the ActiveX palette in labview with the type connector wired to the PropertyObject type. You can get the PropertyObject type by inserting an Automation Refnum and selecting PropertyObject for it from the TestStand API type library.
Hope this helps,
-Doug
07-12-2010 11:58 AM
As Doug mentioned, you will need to cast the ActiveXData parameter to a particular class using the Variant to Data primitive in LabVIEW. In your case, you would cast the ActiveXData parameter to the PropertyObject class (use an Automation Refnum constant and browse to the TestStand API and select the PropertyObject class). Once you've cast the ActiveXData parameter to a PropertyObject, you can then call PropertyObject.GetValString("", 0) to get the Status string.
One thing you should be aware of. When you have a variant that contains an ActiveX reference and you use the Variant to Data primitive to cast the variant to the appropriate type, you must release the reference stored in the variant. For further explanation on this and details on how to properly release the reference stored in the variant, please see the below KB (if you do not follow the instructions in this KB, you will receive PropertyObject leak warnings):
PropertyObjects Were Not Released Warning When Using LabVIEW
Hope this helps.
07-13-2010 08:19 AM
Thanks everyone for the responses. This forum is a great resource for finding out details of TestStand that go beyond the documentation.
I chose to use the GetSequenceContext method of the UIMessage.Thread property and obtain the Status with the TestStand API (see attached).
I was thinking the role of the activeXDataParm was to provide a generic data container, but it seems that it is only a pointer. Due to this, it is the same amount of work/objects (or more) required compared to the GetSequenceContext.
07-13-2010 08:35 AM
You can leave out the first two property/invoke nodes if you pass the ThisContext (type SequenceContext) instead of the thread as ActiveX dataparam.....
Norbert
07-13-2010 09:22 AM
LVB -
You do have to close the Thread reference as well. When a TestStand ActiveX reference is provided by a property or invoke node, the reference count is incremented and you must eventually decrement the reference count in LabVIEW by closing the reference.
Hope this helps.
05-29-2018 03:18 AM - edited 05-29-2018 03:19 AM
@Manooch_H wrote:
LVB -
You do have to close the Thread reference as well. When a TestStand ActiveX reference is provided by a property or invoke node, the reference count is incremented and you must eventually decrement the reference count in LabVIEW by closing the reference.
Hope this helps.
Thank you! I was looking exactly for that. But "eventually" means, that I cannot be sure that the reference that is obtained survives my callback vi?
I am working with acrtor framework and I wanted to transmit the sequence context by user event to actor core in order to make i accessible to the actors private data cluster by a message object. I did this already for some UI messages (for example sequence opened).
In previous versions of my software I provided the actors enqueuer to the calback vi, but then actors events are not handled by actor core anymore.