HP Forums
INPUT Command Syntax (SOLVED). - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: INPUT Command Syntax (SOLVED). (/thread-3466.html)



INPUT Command Syntax (SOLVED). - Spybot - 03-23-2015 05:13 PM


Hi Everyone!!

I guess I need a little bit of help on the syntax of the INPUT command. I'm trying to create some sort of drop-down menu, so I can choose an option.
I read the UG. and the built-in help on the calculator, I entered the corresponding code for that, and I'm still getting an error message. ("see screenshot # 1
")

I'm trying to create something like the screenshot # 2 & 3.

here is my code:

EXPORT program()
BEGIN
INPUT({D,{"OPTION 1","OPTION 2","OPTION 3","OPTION 4"},{20,70,3}},{"Main title"},{"LABEL"},{"HELP 1","HELP 2","HELP 3","HELP 4"},0,0);
END;

Thanks, any help will be appreciated.

[attachment=1827] [attachment=1828] [attachment=1829]


RE: INPUT Command Syntax - Tim Wessman - 03-23-2015 06:44 PM

Two things. You are attempting to create a field for variable D, and then a non-existent type. Look at your variable list: {D,{"Strings"...

Also, you are defining help strings for 4 fields.

Code:
EXPORT program()
BEGIN
INPUT({{D,{"OPTION 1","OPTION 2","OPTION 3","OPTION 4"},{20,70,3}}},"Main title","LABEL","HELP 1",0,0);
END;

Adding { } around the title field and similar is for additional pages of your input form. If you have one, no need to have it.


RE: INPUT Command Syntax - Spybot - 03-23-2015 07:24 PM

Thank You Tim.

I notice something in the piece of code you wrote:

{{D,{"OPTION 1","OPTION 2","OPTION 3","OPTION 4"},{20,70,3}}} ...

In this line, it seems to me that there is an extra pair of brackets {}, so I took them out and ran the program, I realized that it didn't run!, so I put them back in place and it worked again. my question is why an extra pair of brackets make the difference?


RE: INPUT Command Syntax - Tim Wessman - 03-23-2015 08:06 PM

To define a choose in an an input form, you create a list of the form {var,{"choices"...}}.

{ A,B,{C,{"choices"...}} } is 3 objects, A, B and a choose object. Doing {D,{"choices"...} has made one real input D, and then an invalid input item - hence the error.


RE: INPUT Command Syntax - Spybot - 03-23-2015 09:16 PM

That make sense Tim, Thank you for your answer.