From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Modifying sequence variables from Labwindows User Interface

Solved!
Go to solution
Hi,
 
What is the correct procedure for modifying sequence variables from a
LabWindows CVI user interface.
 
 I am currently using an enhanced version of the simple interface that is
shipped with TestStand.
 
I have tried SetValVariant etc. with a ref to the engine  and this didn't
work for me.
 
Should I first be passing the sequence context via PostUIMessageEx ?
 
 
Thanks in advance,
Bill
 
 
0 Kudos
Message 1 of 7
(4,047 Views)

Hey Bill,

Awesome, you are completely on the right track!!!  In order to set a sequence variable from the UI, you need to get access to the execution's sequence context and the best way to do that is to send it via the ActiveX data in a UIMessage and then create your UIMessage handler in your Operator Interface to take the data from your UIR object to the variable via SetValXXX.  I didn't do a search for it, but I think there may be examples posted on the forum or in DevExchange of doing just this.  Have a good one.

Adam B.

0 Kudos
Message 2 of 7
(4,030 Views)

Adam,

Thanks much for the reply. This is what I've done so far:

1.  Sent 'ThisContext' as the activeXDataParam in call to PostUIMessageEx

2.  Received msg in gui handler using TS_UIMessageGetActiveXData (uiMsg, &errorInfo, &SequenceContext)

    where SequenceContext is declared as LPUNKNOWN.

When I try to use  TS_PropertySetValVariant(SequenceContext,  ,  ,  ,),   SequenceContext is expected to be

An ActiveX object handle. How do I reconcile this?

 

Regards,

Bill      

 

0 Kudos
Message 3 of 7
(4,016 Views)

Hey Bill,

Yeah, I forget that this process is a little bit more straightforward in LabVIEW then it is in CVI (just one type cast is necessary).  Here are the steps (and variables) to make it a usable SequenceContext object:

 LPUNKNOWN tempActiveXRef;
 VARIANT tempTSSeqContext;
 CAObjHandle TSSeqContext;

     //Get ActiveX object from UIMessage
   tsErrChk(TS_UIMessageGetActiveXData (uiMsg, NULL, &tempActiveXRef));
   
     //Convert LPUNKNOWN to Variant
   tempTSSeqContext = CA_VariantIUnknown (tempActiveXRef);

     //Convert variant to object handle
   CA_VariantConvertToType (&tempTSSeqContext, CAVT_OBJHANDLE, &TSSeqContext);

tsErrChk(TS_PropertySetValString(TSSeqContext, &ErrorInfo, "MyLookup.String", 0, "Testing"))

I haven't tested this exact code, but I modified some code that I know works for the purpose of demonstration.  Like I said, I wish there was a way to just type cast straight to the Object Handle, but since you are getting an LPUNKNOWN object, you have to first go the variant.  Have a good one.

Adam

Message 4 of 7
(4,011 Views)
Solution
Accepted by bk1

Adam,

Works nicely! Thanks a lot for your help!

Regards,

Bill

0 Kudos
Message 5 of 7
(4,002 Views)

Hi Adam,

I want to do the same thing using LabVIEW. How shall I go?

If you can send me an example it will be a great help.

 

Thanks,

Santanu

0 Kudos
Message 6 of 7
(3,911 Views)
Hi Santanu,

The below link has information about UI Messages with Operator Interfaces.  The last section "Receiving and Handling UIMessages" describes what you are wanting to do.  Also, see attached screenshot of what the VI should look like. 

Let me know if you have any questions.

http://zone.ni.com/devzone/conceptd.nsf/webmain/7aea63ef2fad485c86256d210073725c


0 Kudos
Message 7 of 7
(3,884 Views)