HP Forums
Basic INPUT help - 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: Basic INPUT help (/thread-8081.html)



Basic INPUT help - AngryNapkin - 04-01-2017 01:00 AM

I am trying to create a basic input. Here is what I got:

EXPORT TEST()
BEGIN
LOCAL A;
INPUT({{A,[1]}},"TEST"," INTEGER INPUT:")
END;

I want to limit the inputs to integers only, and not floats, however when I try to enter anything into the box, I get "Invalid Input".

What am I not understanding here?


RE: Basic INPUT help - Giancarlo - 04-01-2017 09:33 AM

Hello,
With os version 10637 it didn't work for me as well. .
It worked with type 2 (strings) and type 0 (reals) not with type 1 (integers).

Thanks


RE: Basic INPUT help - Didier Lachieze - 04-01-2017 10:17 AM

It works but you have to enter the integer with a # prefix and an optional base suffix (d,b,o,h).


RE: Basic INPUT help - AngryNapkin - 04-01-2017 04:13 PM

Ok. Well that seems counter intuitive. I wanted to use the input form as a easy way to input values and work on them, using the filter type of integer seems like a waste if you have to enter a #d for each enter instead of just entering a integer.

I thought it would be an easy way to protect against non integer values. Leaving it open to all types will be fine for now until I get more familiar with this programing language.


RE: Basic INPUT help - AngryNapkin - 04-01-2017 04:31 PM

Well let me ask some advice, because this relates to my other question I posted with the solve() not working right.

Basically I am trying to make a simple INPUT dialog that updates every time the user enters some values. I have the INPUT running in a while loop.
When the number are input, the variables get worked on, and re updated, and the loop restarts, populating the INPUT with the new values.
I wanted to use the simple solve() command to solve for one of three values.
For example

While INPUT({A,B,C},"Test Input) > 0 DO
// Some testing here to find which solve() line to run
solve(A+B=C,A)sto>A
solve(A+B=C,A)sto>B
solve(A+B=C,A)sto>C
END;

So basically, i check to see witch value needs updating, and based on the other two, the solve() finds the answer. This is a crude example, but about as simple as I need.

I know there is the Solver which does work, but I was trying to get this to work in a program without the need to have to enter a formula first and then run the Solver.


Is there an easier way to go about this?


RE: Basic INPUT help - Tim Wessman - 04-06-2017 05:28 PM

(04-01-2017 04:13 PM)AngryNapkin Wrote:  Ok. Well that seems counter intuitive. I wanted to use the input form as a easy way to input values and work on them, using the filter type of integer seems like a waste if you have to enter a #d for each enter instead of just entering a integer.

"integers" in home refer to a fixed size, specific base encoded value more akin to a lower lever computer register value. For example, you can have a 16 bit, signed, octal number and similar things.