Skip to main content
5-Regular Member
May 31, 2024
Solved

Prime 10 Text box

  • May 31, 2024
  • 1 reply
  • 1288 views

Hi. As a beginner I looked at

https://community.ptc.com/t5/Mathcad/Mathcad-Prime-10-Text-Box-Advanced-Controls/m-p/952250#M212068 ...

and tried to modified it to a simple comparison if a value "a" is less or bigger than 1. For example an unit check of stress in some member is a=0.86. If a < 1 then member pass, if a => 1 then member fails. But a message "a" is undefined at row xxx appeared and I could not find a reason. I am sure that it is easy for experienced people in JScript. Thanks. D.

Best answer by Werner_E

You would have to attach the sheet with the failing component.

If you get the message you described it means that you had used variable name "a" in your script. have you defined variable "a" in your script and assigned it to the input variable? Note that you can't expect the script to know the variable name of a Prime variable.

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
May 31, 2024

You would have to attach the sheet with the failing component.

If you get the message you described it means that you had used variable name "a" in your script. have you defined variable "a" in your script and assigned it to the input variable? Note that you can't expect the script to know the variable name of a Prime variable.

 

5-Regular Member
June 3, 2024

Hi. Thanks for a prompt answer. Finally I have found where I did a mistake.

It was surprise for me that when I gave away rows with definitions of TextBox colors,

the color of field stayed as  it was at that moment, so green, when it was green or red when it was red:

   TextBox.Font.Size = 23;
   if (Inputs[0].Value[0] > Inputs[0].Value[1]) {
         TextBox.BackColor(0x00BB00);
         TextBox.ForeColor(0xFFFF00);
         TextBox.Text("PASS"); 
   } else {
  TextBox.BackColor(0xFFCCCC);
              TextBox.ForeColor(0xCC0000);
TextBox.Text("FAIL");
 
When I rewrite rows into a new command of TextBox,  result was without color -  transparent field.
I could not find till now where I can define field properties.
Have a nice day.
D.