NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I programatically open a LabView Front panel?

I want to use a test stand variable (perhaps a sequence global) to control whether certain VIs open their front panels, and wait for subsequent operator interaction. Can I get there using the API and something like this:  "Step_TSInfoProp.TSInfo_StepAdditions.LVStep_ModulePathProp" ?
 
I tried passing a boolean to the VI and then having it optionally open its own front panel using the VI Server, but I could not see it because it would always be behind the TestStand Window.
0 Kudos
Message 1 of 12
(7,029 Views)
Could you not use the TestStand Modal Dialog functions from your LabVIEW VI?  This will make the window jump to the top and, importantly, stay there - no matter how clumsy your user is with the mouse.
0 Kudos
Message 2 of 12
(7,014 Views)

I have tried making the VI property >> Window appearance >> Dialog.

This does make the front panel come up in front of everything else, but it does this every time, all the time. I can't make it dependent on the value of some variable in TestStand. In TestStand also there is a a check box when one selects and configures the VI for the step, that says something like "open front panel when called". But that check box is a developer level thing at script development time, not a run time thing. It too is essentially a compile time option. I'd like to find a way that I could run an expression before the step that would set that little option.

0 Kudos
Message 3 of 12
(7,010 Views)
I was thinking you could use the VI server as you explained, together with the TestStand modal dialog bits.  You could make a subVI that does all this, with just the Sequence Context and a boolean switch as inputs (and error in/out).
 
Could you not just have a precondition that skips your VI step from TestStand if the condition is not met?  I don't understand why you would want to run a user interface VI if you're not interfacing with the user.  Are you displaying measurements while they happen or something?  Presumably you're not expecting anyone to press a button.
 
I've had a browse about in TestStand, and I can't find a switch for the show panel thing either.  I'm all in favour of doing as little as possible in TestStand!
0 Kudos
Message 4 of 12
(7,005 Views)

Just remembered, you can't use the TestStand modal VI from within a subVI - it will only work if within the top-level VI, as it makes the VI that called it modal Smiley Sad

If you have a look in the VI itself though, you'll see how it works - it uses the call chain function to get the calling VI's name.  It takes element 1 of the call chain (the VI above itself).  By copying its innards into a new VI you should be able to make an equivalent that would work from lower down the call chain.  I haven't tried it, but I think you could use the second-highest index of the call chain to give the top-level VI.  The highest one is some kind of proxycaller that TestStand interfaces with - the one below that is your called VI.  This fix needs to be made by NI really, as it's a pain having to use this in your top-level VI for it to work.

0 Kudos
Message 5 of 12
(7,004 Views)

In fact, from looking at it, it seems to open the front panel too, so you won't need to use the VI server as it does it for you.

0 Kudos
Message 6 of 12
(7,003 Views)
Hi Paul and Sean,
 
There is a hidden property that contains the values specified in the specify module dialog box, such as the "Show VI Front Panel when Called".  To ensure that you can see this property, you can go to Configure >> Station Options, select the preferences tab, and check the Show Hidden Properties check box.  After doing so, you can see the value by right clicking on a LabVIEW step and selecting Open Tree View.  Next, navigate to Step >> TS (Which contains all the hidden properties) >> SData >> ViCall >> ShowFrnPnl.  You can now modify this value using the lookup string Step.TS.SData.ViCall.ShowFrnPnl.  This should get you on the right track, however, if you have any additional questions, please repost and I'll make sure we get answer to you.  Thanks and have a good one.
 
Adam B.
Applications Engineer
National Instruments
Message 7 of 12
(6,988 Views)

Sean,  The reason for doing this is that the client wants a "debug level" control of some sort. If set below some value, the VIs just do their thing, take their measurements, report, or whatever and go on their way blindly as what we expect a good test sequence to do. However when this value is set above some level (the threshold may be different for various categories of tests) the VI becomes interactive. This would allow an operator to see a measured value, and possibly tinker with the instrument parameters or the UUT, before continuing on. This might be similar to a single step command, but not necessarily pausing at every step. Inside of the VI I can test the value of the variable (either passed in through the connector pane or via the sequence context) and thus decide whether to be interactive or silent. I can also use the VI server to open my front panel or not.  But in doing so, even though I try to make the VI panel frontmost, it is hidden by Teststand. If the VI attribute is "dialog" then it does show up on top of everything else, but unfortunately does so even when I don't tell it to open at all.

PC

0 Kudos
Message 8 of 12
(6,988 Views)

Adam,   Thanks. I knew it had to be in there somewhere. I even tried to use a preceeding LV step to access the API to touch any and all steps that might need to show theit panels. But this hidden attribute you mention seems to be just the thing I need. I am heading out to the lab to try it now. I wonder if I can set this bit in a Pre expression for the step it is trying to control, or whether it must be in any preceeding step. I will probably have found this out myself by the time I get back to read your reply. Thanks again.

PC

0 Kudos
Message 9 of 12
(6,985 Views)

I'd be inclined to pass the user information down to the VI, then have a single subVI in all the VI's that has a look at the privilege level and decides whether to pop up and wait for user action.  Your VI will need to know whether it's going to pop up anyway, as it needs to know whether to wait for the OK from the user.

I'd (ab)use one of the existing privileges for this purpose, e.g. StationGlobals.TS.CurrentUser.Privileges.Debug.ControlExecFlow.  Pass this boolean to the VI and let it decide what to do.  Or you could add an additional privilege to the User Types (I've never tried this, but I'm sure you can).

This is just my preference - as I said, I try to keep as little as possible in TestStand. 

0 Kudos
Message 10 of 12
(6,966 Views)