NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

event callback engine error

I modified the TS 4.0 HMI to where it has a button (in the execution view) that launches (adobe acrobat) a summary .pdf report.  This is not really a callback question, but more of a what am I doing wrong question.  In the attached bitmap, (please pardon the mess, but I kept trying stuff to isolate the problem and didn't clean up)  this callback is called when the user clicks the "LaunchReport" button in the Execution View.  It currently is called when a MouseUp event happens with this button, but that was just an attempt to find the real problem.  Anyway, I've disabled the troublesome code.  If I hard-code a path to a pdf, the button click causes that pdf to open up in adobe. 
 
What I need to do, however, is get the sequenceContext so that I can get to a FileGlobal containing the report path and pass that in instead.  I cannot seem to set a breakpoint in this code to find where the error is.  All I know is that if I enable the code, adobe never comes up.  I thought it was possibly in my GetFileGlobal VI, so I commented him out still the same behavior.  In the final code, I'd like to route the reportpath found in fileglobal upto the LaunchExternalViewer 'FilePath' input. 
 
As experiments, I kept the hard coded value there, but I tried wiring the Engine reference to the GetUIMessage Node, etc - with and without my GetFileGlobal VI, the code just does nothing.  I'm wondering if there's anything obviously wrong here. 
0 Kudos
Message 1 of 7
(3,783 Views)

Hi,

Are you sure your FileGlobals is valid ie its available when you are trying to read it?

As an experiment have you tried using the StationGlobals, if you can get it from there, then  at least you know the mechanism works.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 7
(3,764 Views)
Although it may still hickup at the FileGlobal stage, that doesn't appear to be the initial problem.  I (one-by-one) cut out the FileGlobal, then the GetSequenceContext, then the GetThread.  If I kept the Execution there, it still works, but the GetThread seems to be breaking things.  I'm not sure if the index (0) is having an effect.
0 Kudos
Message 3 of 7
(3,749 Views)

Have you tried using Execution.ForegroundThread() rather than GetThread. This depends if you have Tracing on.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 4 of 7
(3,745 Views)
Hello,

If I understand correctly, this button will be clicked after execution of the test sequence.   At this point, the File Globals will be out of scope, and will only retain their default values.  Thus, I would again echo what Ray has suggested, and try storing the file path to your station globals. This will resolve any problems of scope you may be seeing, and let us know if the code getting the value of the variable is working correctly.

NickB
National Instruments
Applications Engineering
0 Kudos
Message 5 of 7
(3,733 Views)
I do not see Execution.ForegroundThread().  Regardless, I can't even get to that point.  I can get the UIMessage reference, but if I try to get the Execution, the code does not proceed. So I can't even attempt to get the thread.  I did notice that I could skip getting the Execution, and go directly to the Thread to get to the SequenceContext.
 
If I go with the StationGlobals (vs FileGlobal) approach, would I still need to drill all the way down to SequenceContext, or is there a quicker way (starting with the Engine)?
0 Kudos
Message 6 of 7
(3,724 Views)
Engine.Globals returns a read only property object that contains all of your station global variables.  I think this would do it for you.

NickB
National Instruments
Applications Engineering
0 Kudos
Message 7 of 7
(3,719 Views)