08-21-2012 01:14 AM
Hi,
I have written a simple StepType in C# (please see attachment). I wish to transfer the value entered by the user in the text field to TestStand.
The step type works fine, but now I want to open expression browser (using button f(x), somewhat similar to TestStand) and access TestStand variables and then enter this variable in the text field.
I have seen a similar example "HP34401a_StepTypeExample.seq" with custom step written in CVI (delievered with TestStand) but I need one in C# which could explain to which library do I have to make refrences, which functions are available (help files if possible).
Any pointer would be of great help.
Regards
RB
08-21-2012 05:56 AM
Update: Added reference to dotNet.TestStand.Interop.API assembly, but I still lack an example in .NET.
08-22-2012 10:40 AM
Hi,
if you want to use the Operators/Functions provided in TestStand in your code module, you can use the method EvaluateEx()
TestStand provides two methods exposed by PropertyObject class called Evaluate()
and EvaluateEx()
. You can pass each method a string with an expression that contains TestStand Operators/Functions and a variable or property. TestStand will return the evaluated expression as a PropertyObject object reference.
A possible idea for you:
- Use TestStand UI ExpressionEdit Control
- Use string controls for your expressions,
- Use the Engine.CheckExprSyntax or Engine.CheckExpression methods to check the expression syntax.
08-23-2012 01:10 AM
Thanks for hint. I could follow your advice to create propertyObject from sequenceContext. Will try your solution soon.
Do you have any example? I have all in CVI, searched intensively on NI website but no success.
08-23-2012 06:44 AM
Hi
Unfortunately, I do not have any example.
You typically do not need to edit expressions in a user interface application, you can connect a manager control to a read-only ExpressionEdit control to display text information about the application state, such as the pathname of the sequence file selection or the name of the current user.
You can also use ExpressionEdit controls in dialog boxes for step types and in tools in which you prompt users to enter a TestStand expression.
You can find all Properties, Methods and Events you need:
05-30-2016 03:02 PM
"connect a manager control to a read-only ExpressionEdit" is not helpful at all. Here is a thread that shows how to do this:
Took me a little while to find this so I thought it was worth spreading the word.