NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the DisplayEditNumericFormatDialog method of Teststand API

Solved!
Go to solution

Hi,

 

I have to build a coustom report generator plugin for Teststand by using c#. In the Teststand API there is a method integrated called "DisplayEditNumericFormatDialog"

http://zone.ni.com/reference/en-XX/help/370052M-01/tsapiref/reftopics/propertyobject_displayeditnume...

 

Is there a way to set the sample value of the window that will appear if the method is called?

 

Window

 

I do the following things:

 

 private void button1_Click(object sender, EventArgs e)
        {
            mChanged = true;
            bool tempbool;

            PropertyObject tempobject = mEngine.NewPropertyObject(PropertyValueTypes.PropValType_Number, false, "", 0); //creates a temporary PropertyOgject to show the EditNumericFormatWindow 

            tempobject.NumericFormat = mConfig.GetValString(P_PluginSpecific_Options_NumericFormat, 0); //read the numeric format of the plugin options
            tempobject.DisplayEditNumericFormatDialog("Numeric Format", out(tempbool), 1); //Show the EditNimericFormatWindow

            if (tempobject.NumericFormat == "") mConfig.SetValString(P_PluginSpecific_Options_NumericFormat, 0, "%$.13g");
            else mConfig.SetValString(P_PluginSpecific_Options_NumericFormat, 0, tempobject.NumericFormat);

            MessageBox.Show(tempobject.NumericFormat.ToString());
        }

 

thanks in advance

0 Kudos
Message 1 of 4
(4,098 Views)

Hwllo f4bo

 

in TS i used an expression with this syntax

 

RunState.Engine.DisplayEditNumericFormatDialog("","%2.2d",0,20)

 

the last value set the sample value

 

Hope it helps

best regards
Alexander
0 Kudos
Message 2 of 4
(4,069 Views)
Solution
Accepted by topic author f4b0

Hello f4bo,

 

attached a sequence which show how this can be done.

 

Locals.Local = RunState.Engine.NewPropertyObject(PropValType_Number, False, "",0x1),
Locals.Local.AsPropertyObject.NumericFormat = "%b",
Locals.Local.AsPropertyObject.SetValNumber("", 0, 20),
Locals.Local.AsPropertyObject.DisplayEditNumericFormatDialog("Fake title", False, 0)

best regards
Alexander
0 Kudos
Message 3 of 4
(4,041 Views)

Hello Duffy2007

 

this solution does work!

thanks for your quick support!

0 Kudos
Message 4 of 4
(4,031 Views)