INPUT dropdown box bug and work around
05-22-2015, 06:53 PM (This post was last modified: 05-27-2015 03:45 PM by Gene222.)
Post: #1
 Gene222 Member Posts: 101 Joined: Feb 2015
INPUT dropdown box bug and work around
I have been trying to creating multiple dropdown boxes using the INPUT command, and I just can't get it to work. When I click on the first dropdown box on the virtual calculator, I get an error saying the application has crashed and will be restarted. The input code is below. (Not sure how to use to the "insert formatted code" button.)
Code:
 LOCAL Units, Program; EXPORT InputTest() BEGIN INPUT(    {   {Units,{"English (BG)", "Metric (SI)"}},   {Program,{"n, Q, S, D, y/D Calcs", "Given V, n, Q, y/D  Solve D, S", "Given V, n, Q, D  Solve y/D, S"}}   },   "Program Options",   {   "Units",   "Program"   },   {   "Select BG or SI Units",   "Select Program"   }   ); PRINT("Units= "+Units); Print("Program= "+Program); END;

EDIT

I was adjusting some of the home settings and ran the program again. When I click on the first dropdown box, a dropdown box with three choices appeared, where the third choice said "Unknown Type", as shown in the attached screen shot. This was odd, because the first dropdown box code only specified two choices.

So, on the above code for the input command, I added a third choice to the first dropdown box. The program worked fine. See code below. When I deleted the third choice, the program crashed. I also tried deleting one of the three choices in the second dropdown box, and to my surprise, the program worked fine. It seems that the first dropdown box will only work if it has the same number of choices as the second dropdown box.

Code:
LOCAL Units, Program; EXPORT InputTest() BEGIN INPUT(   {   {Units,{"English (BG)", "Metric (SI)", "3rd Choice"}},   {Program,{"n, Q, S, D, y/D Calcs", "Given V, n, Q, y/D  Solve D, S", "Given V, n, Q, D  Solve y/D, S"}}   },   "Program Options",   {   "Units ",   "Program "   },   {   "Select BG or SI Units",   "Select Program"   }   ); PRINT(); PRINT("Units= "+Units); PRINT("Program= "+Program); END;

[more EDIT 5/24/15]

I updated the software on both the calculator and virtual calculator from 20141203 v6975 to 20150427 v7820 and I still got a similar error.

When I ran the program the first time on the virtual calculator and clicked on the first drop down box, the drop down box displayed 3 choices even though only 2 choices were specified, but I think the program worked. I ran the program a second time, and click on the first drop down box. I got three choices, where the third choice was "NaN". I ran the program a 4th time, and the 3rd choice displayed Chinese characters. On the 5th time, "Unknown Type" was displayed as the third choice. When I ran the program the 6th time, I got an error message box that said, "The application has crashed and will restart." and the virtual calculator restarted. When I ran the program the 7th time, I got the same error message stating the the application has crashed.

Clearly, something was not right. I tried different combinations of commas, brackets in the input command, but nothing worked. I changed the variable names, thinking that a variable with the same name in a different app might be corrupting the program, but that did not work. I copied the code and pasted it as ascii unformated text, but that did not help.

In the end, I added double quotes in the first drop down box as a third choice as a work around solution. A blank third choice show up in the drop box, but that is not a big deal. The IF statement that uses the drop down box variable runs the second choice should the blank third choice ever be selected. Below is the INPUT statement I ended up using where there are double quotes as the 3rd and 4th choices to match the number of choices in the second drop down box.

Code:
LOCAL Units, Program; EXPORT InputTest() BEGIN INPUT({   {Units,{"English (BG)", "Metric (SI)", "", ""},{20,70,1}},   {Program,{   "n, Q, S, D, y/D  Calculator",    "Given V, n, Q, y/D  Solve D, S",    "Given V, n, Q, D    Solve y/D, S",   "Given V, n, S, y/D  Solve D, Q"},{20,70,3}}   },   "Program Options",   {   "Units",   "Program"   },{   "Select BG or SI Units",   "Select Program"   }); PRINT(); PRINT("Units= "+Units); PRINT("Program= "+Program); END;

[/color][some more EDIT 5/25/15]

Other people have had problems w
ith multiple drop boxes with no real solution. See the following posts.