NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How To Use UI Message activeXDataParam

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)?

CLA, CTA
0 Kudos
Message 1 of 8
(4,817 Views)

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

 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(4,786 Views)

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

0 Kudos
Message 3 of 8
(4,769 Views)

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.

Manooch H.
National Instruments
0 Kudos
Message 4 of 8
(4,749 Views)

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).

 

  • Slightly off-topic, but in the attached snippet, I did not close the UIMessage.Thread reference.  My guess is this should be closed by TestStand, is that correct?

 

 

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.

 

  • What are some use cases where the activeXDataParm would be more appropriate than the GetSequenceContext method of the UIMessage.Thread property?
CLA, CTA
0 Kudos
Message 5 of 8
(4,730 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 8
(4,724 Views)

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.

Manooch H.
National Instruments
Message 7 of 8
(4,718 Views)

@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.   

0 Kudos
Message 8 of 8
(2,903 Views)