NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

passing TS.UImessage reference to LabVIEW event structure as UserEvent data

Hi,

 

I'm building a relative simple operator interface. To update some indicators on the interface I want to use UIMessage UIMsg_ModelState_TestingComplete (UIMessageCode: 34). I already implemented it using a callback.vi. Now I want to let this callback vi generate a labVIEW userevent and pass the TS.UImessage reference (UIref) from the eventdata cluster to the LabVIEW eventstructure where I can acces it's properties (like eventcode, stringData, NumericData etc.) if I need to. The strange thing is that the code only works when I enable the "debug" popup inside the Diagram Disable Structure ... Disabeling reentrant execution of the Callback has no influence.

 

Could it be that the Uimsg reference is destroyed before it's handled by the eventrstructure? Should I make a clone (Convert UImsg-object to property object using AsPropertyObject-method and PropertyObjectClone-method)?

 

UIMessageEvent Event to LV_Event Callback.png

 

 

The part in the event structure that handles this user event looks like this:

screenshot.8.png

 

Thanks,

Roger

0 Kudos
Message 1 of 2
(3,342 Views)

It looks like I found a solution. It looks like the uiMsg object is destroyed by Teststand directly after finishing the execution of the callback-vi.  If I make a PropertyObject of it and convert it back to a TS.UIMessage object it works. First I implemented code to Clone this PropertyObject using the PropertyObject.Clone-method, but this gives a error : -17001: "does not support this constructor ... " (Why ?)

 

LabVIEW EventStructure handleUserMessageEvent AsPropertyObject.png

In the eventstructure I close (destroy) this object after I retrieved the desired porperties from it.

Can someone confirm if this is the right way and I don't create a memory leak this way?

 

screenshot.10.png

 

The corresponding description for error -17001 is:

Error -17001 occurred at TEMessage Does not support this constructor in HCCP UI - UIMessageEvent LV_UserEvent Callback.vi->HCCP UI - UIMessageEvent LV_UserEvent Callback.vi.ProxyCaller

 

Thanks,

Roger

0 Kudos
Message 2 of 2
(3,321 Views)