NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

popup in a callback

This is probably my 20th question related to this silly button ... Anyway, for those not familiar with my saga, I have a "Launch Report" button on my (customized) TestStand HMI that, when clicked, invokes a Callback that is supposed to get a StaionGlobal containing the path to the report, Launch Adobe Acrobat (since it's a pdf file), and show the user a summary report we created for him (using VBScript and DIAdem, we generate a pdf from a .TDM created during the test).  Anyway, the cirlcled code (in the attached png) is simply a place holder, just so it wouldn't bomb, and would prove that I could launch Adobe. 
 
I'd like to replace that temp code with some code that takes the path provided, validates it and sees that the desired file indeed exists.  If it does, I'll call the launchviewer.  If not, I'd like to show a popup saying "The file D:\folder\file.pdf was not found", then exit.  As one of my earlier threads related to this button mentions, (which is why I'm useing the StationGlobals), I've had bad luck trying to get the sequenceContext.  I need that (unless there's another way) to do a TestStand - Start Modal and End Modal for the popup I'd like to display.  I was going to use the newly discovered NotifyStartOfModalDialogEx but it too needs the sequenceContext (right?).
 
Also, as a general question, where does the code go after an asynchronous event like this.  I'm wondering that because my second idea was to modify the callback (although I don't think it's possible) so that it would return a string (path) and a boolean (found file) and in TestStand, I'd bring up the popup there (if necessary).
 
Thoughts?
0 Kudos
Message 1 of 9
(4,194 Views)
Although I still have the original (question) problem, I have another odd thing occurring in this callback.  The VI (refer to previous attachment) I use to get the desired station global is (for some reason) not working.  However, I can't seem to set a breakpoint anywhere in this callback to determine why.   Also, with my lookup string set to "StationGlobals.UUT.ReportPath", my lookup subVI (I'm not sure why yet) doesn't find the string (in StationGlobals) and must be returning a 'False' because the pdf in the false case gets launched.  if I change my lookup string from StationGlobals.UUT.ReportPath to just UUT.ReportPath, the attached warning pops up.  It's implying that it doesn't know how to open the file specified (which, if it's really finding it in StationGlobals, is set to "D:\ATE\demo.pdf").  I'm not sure if I have to use double backslashes in the path name.  Anyway, if I could just set a break point and trace through, I could figure out what the heck is going on.
0 Kudos
Message 2 of 9
(4,171 Views)

Hi mrbean,

What version of TestStand and LabVIEW are you using?

If all you're doing is trying to make a popup modal, I noticed that there was a Corrective Action Request made for a similar issue in TestStand 3.5 and was reported to be fixed in TestStand 4.0.

For a workaround, please refer to the following forum post:
TestStand Forum: Why are my LabView Dialog Boxes no longer modal when using the Example LabVIEW Operator Interfaces?
http://forums.ni.com/ni/board/message?board.id=330&thread.id=10473&view=by_date_ascending&page=1

Let me know if this helps!

Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 3 of 9
(4,161 Views)

I'm using LabVIEW 8.5 and TestStand 4.0.  My issue is not how to make a popup modal.  Rather, given what I have available to me in the Callback I attached (originally), how can I get access to the SequenceContext which, I think, is essential as an input to the modal routines.

Second, since I'm having so many problems in this callback, I was wondering why I couldn't set a breakpoint in the callback.

0 Kudos
Message 4 of 9
(4,158 Views)

I've had no further success, but I did change my interface slightly so that it's going toward my ultimate goal of having access to the SequenceContext for (1) my retireive StationGlobal routine, and (2) in case the lookup string is not found, to bring up a popup to the user.  My questions now are...

(A) Do you see anything wrong with how I'm trying to get the SequenceContext ?

(B) I have a feeling that my problem is due to something I'm doing in the Thread->GetSequenceContext call.  I wasn't sure what to do with the CallStackIndex, so I came up with my best guess.  I actually tried values of 0,1,2,3, then I added the code you see.  My logic was that if the callstack is size '5' (== n) then the nth-1 entry in the CallStack should be the last guy that called us.  This doesn't seem to work, though.  In fact, in the Get Station Global VI front panel, I see an error that says Err 97 (Unknown System Error in CC_ATE_Full UI - LaunchRptCallback.vi:2->CC_ATE_Full UI - LaunchRptCallback.vi.ProxyCaller)

0 Kudos
Message 5 of 9
(4,147 Views)
Hi mrbean,
 
I did notice something that jumped out at me when I looked at your code to get the Sequence Context.
 
You are currently passing in CallStackSize - 1.
If you look at the documentation for GetSequenceContext, you will see that:
"Call stack index 0 specifies the sequence context for the most recently executing step group."
 
What happened when you passed in 0 instead?
Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 6 of 9
(4,143 Views)
The same thing seems to happen no matter what I pass in - nothing.  Actually, I get that error 97 I mentioned (shows up in my subVI front panel), which has the side effect of not retrieving any station globals.  Like I said, I started out with a call stack index of 0, then I tried, 1, 2, 3, then the code that's shown.  It's quite a mystery to me.
0 Kudos
Message 7 of 9
(4,141 Views)
Anyone have any clues on this issue?
0 Kudos
Message 8 of 9
(4,016 Views)
mrbean,
 
I think I can answer a few of your questions, so let me break them down and answer one at a time:
  1. How can I search for a file to check if it exists?
    • One of the ways you can do this is to use the Engine method FindFile().  This method will search for a file on your computer using TestStand's search directories, and will return true if the file is found, or false if it is not found.  It will also return to you the full path of the file, if the file is found.
  2. Why am I getting an error that it doesn't know how to open my file?
    • You are trying to open your .pdf file with the TestStand engine, but the Engine does not know how to open a file of that type.  If you would like to continue to use the LaunchExternalViewer method of the TestStand Engine, you will need to define that .pdf files should be opened with an appropriate viewer.  You can do this by going to Configure»External Viewers... from the sequence editor.  This information will be persisted in TestExec.ini so it can be used from your LabVIEW UI as well.
    • Another possible way to open your file is to use the SystemExec.vi.  Attached is a screenshot showing how.  You can also read this KnowledgeBase for more information.
  3. Why can't I access the sequence context correctly?
    • Unfortunately, I don't have enough information to answer this question.  I see that you are in a callback registered from the Application Manager.  What event is this callbacked fired for?
  4. Why can't I put a breakpoint in my VI?
    • LabVIEW callback VIs are re-entrant VIs, and they must be reentrant to properly respond to events.  So I'm not sure if you can put a breakpoint in this type of VI.  That's probably a question for the LabVIEW forums (Make sure you ask them about putting a breakpoint in an "ActiveX event callback VI")  In the meantime, I find that using a One Button Dialog works rather well for debugging purposes.  Also, you can use a general error handler inside that VI to catch any errors.


Message Edited by Josh W. on 06-04-2008 12:23 PM
Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 9 of 9
(3,957 Views)