04-17-2006 08:48 PM
Solved! Go to Solution.
04-18-2006 10:28 AM
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.
04-18-2006 12:34 PM
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
04-18-2006 01:07 PM
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
04-18-2006 02:01 PM
Adam,
Works nicely! Thanks a lot for your help!
Regards,
Bill
06-20-2006 07:58 AM
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
06-21-2006 11:15 AM