HP Forums
INPUT question - 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 question (/thread-1468.html)



INPUT question - Eddie W. Shore - 05-30-2014 02:20 AM

I am working a tutorial for the improved INPUT command (at least the basics of it). I have the following program that calculates sin(2A)^2:

Code:
EXPORT IN5()
BEGIN
// Checkbox: Angle Mode
INPUT({{M,1}},"Check for Degrees");
HAngle:=M;
// Ask for Angle
INPUT(A,"Angle");
// Results
PRINT();
PRINT("SIN(2A)^2");
PRINT(SIN(2*A)^2);
END;

The program IN5 works the way it is, but is there a way to combine two (or more) input types?


RE: INPUT question - Mic - 05-30-2014 05:24 AM

https://www.youtube.com/watch?v=WKKRqpbnd14&list=UUGf3GYzM-kap72XM4N8gi6w


RE: INPUT question - Eddie W. Shore - 05-30-2014 12:05 PM

(05-30-2014 05:24 AM)Mic Wrote:  https://www.youtube.com/watch?v=WKKRqpbnd14&list=UUGf3GYzM-kap72XM4N8gi6w

So it is best to keep the types of input (e.g. Checkboxes and prompts for numerical data) separate. Thanks.


RE: INPUT question - acmeanvil - 05-30-2014 02:11 PM

Hi there,
Is there documentation for the new input() function? Google has failed me so far.
Thanks


RE: INPUT question - Bob Frazee - 05-31-2014 02:11 AM

I have also been experimenting with the new INPUT features. I have been able to get the check boxes to work. I have been able to get the choose field to work (I call it a drop down box), but when using the "pos" option on it, I have been unable make the box narrower.

I have been unable to get the Edit Field to work. The manual shows the syntax identical to the checkbox. If I use a "-1" in the "allowed_types_matrix" position(as the manual shows), I get an "invalid input" error message. If I use 0 or a positive number, I get a checkbox.

Is there something I am missing? Any suggestions?
Thanks
rcf


RE: INPUT question - Eddie W. Shore - 05-31-2014 03:22 AM

(05-30-2014 02:11 PM)acmeanvil Wrote:  Hi there,
Is there documentation for the new input() function? Google has failed me so far.
Thanks

Here is a some information regarding INPUT:

http://edspi31415.blogspot.com/2014/05/hp-prime-ways-to-use-input-command.html

This covers some simple forms of INPUT: basic, type specification, checkboxes, and choose boxes (drop down boxes).


RE: INPUT question - rprosperi - 05-31-2014 07:17 PM

(05-31-2014 03:22 AM)Eddie W. Shore Wrote:  Here is a some information regarding INPUT:

http://edspi31415.blogspot.com/2014/05/hp-prime-ways-to-use-input-command.html

This covers some simple forms of INPUT: basic, type specification, checkboxes, and choose boxes (drop down boxes).

Good samples Eddie, very useful to clarify the docs which, while no doubt accurate, can be complex, confusing and threatening to new programmers or folks just learning Prime. Straightforward examples like these are quite useful as a starting place. Thanks.


RE: INPUT question - Tim Wessman - 06-02-2014 02:12 PM

(05-30-2014 12:05 PM)Eddie W. Shore Wrote:  So it is best to keep the types of input (e.g. Checkboxes and prompts for numerical data) separate.
No. Why would it be? Mix and match as desired.


RE: INPUT question - Dougggg - 06-02-2014 05:00 PM

I have tried combining types of inputs and get strange results

For Example:

INPUT({{LAT1,[0]},{LAT1D,{"N","S"}}},"LOCATION INPUT",{"LAT 1","DIR"});
returns
LAT1=0 and
LAT1D={"N","S"}

when you press ok
display on the form is as expected Line 1 is LAT1 and Line 2 is a Choose for N or S

do I have syntax error?

Although I cant do much more my editor keeps crashing and is now gone


RE: INPUT question - Eddie W. Shore - 06-02-2014 07:34 PM

(06-02-2014 05:00 PM)Dougggg Wrote:  I have tried combining types of inputs and get strange results

For Example:

INPUT({{LAT1,[0]},{LAT1D,{"N","S"}}},"LOCATION INPUT",{"LAT 1","DIR"});
returns
LAT1=0 and
LAT1D={"N","S"}

when you press ok
display on the form is as expected Line 1 is LAT1 and Line 2 is a Choose for N or S

do I have syntax error?

Although I cant do much more my editor keeps crashing and is now gone

I get something similar too.


RE: INPUT question - Mark Hardman - 06-02-2014 09:01 PM

(05-30-2014 02:11 PM)acmeanvil Wrote:  Is there documentation for the new input() function? Google has failed me so far.

Here's an example using the new positioning capabilities of the INPUT command:

Code:
EXPORT MyApp()
BEGIN
LOCAL LAT1,LON1;
LOCAL LAT2,LON2;
LOCAL SOG;
LOCAL UOM:="KNOTS";
INPUT({{LAT1,[0],{25,15,0}},
       {LON1,[0],{70,15,0}},
       {LAT2,[0],{25,15,1}},
       {LON2,[0],{70,15,1}},
       {SOG,[0],{25,15,3}},
       {UOM,[2],{70,15,3}}},
       "Enter Position",
       {"Latitude 1:","Longitude 1:","Latitude 2:","Longitude 2:","Speed OG:","UOM:"});
PRINT(LAT1);
PRINT(LON1);
END;

[attachment=736]

HTH

Mark Hardman


RE: INPUT question - Mark Hardman - 06-02-2014 10:30 PM

(06-02-2014 07:34 PM)Eddie W. Shore Wrote:  
(06-02-2014 05:00 PM)Dougggg Wrote:  I have tried combining types of inputs and get strange results

For Example:

INPUT({{LAT1,[0]},{LAT1D,{"N","S"}}},"LOCATION INPUT",{"LAT 1","DIR"});
returns
LAT1=0 and
LAT1D={"N","S"}

when you press ok
display on the form is as expected Line 1 is LAT1 and Line 2 is a Choose for N or S

do I have syntax error?

Although I cant do much more my editor keeps crashing and is now gone

I get something similar too.

I've had some success getting this to work for a single dropdown in the input form:

Code:
EXPORT MyApp()
BEGIN
LOCAL UOM;
LOCAL UOM2=0;
LOCAL UOMLIST:={"KNOTS","MPH","KPS"};
INPUT({{UOM,[1],{0,0,0}},
       {UOM2,UOMLIST,{15,85,2}}},
       "Enter Units",
       {"","UOM"});
PRINT();
PRINT(UOM);
PRINT(UOM2);
END;

This gives you the following:

[attachment=743]

Depending on the selection, the first variable in the form is assigned the zero-based index of the selected item from the dropdown:

[attachment=744]

I'm not sure how much more useful this is than CHOOSE. Adding any additional variables to the INPUT form causes the Prime to crash.

Mark Hardman


RE: INPUT question - slawek39 - 07-13-2014 12:21 PM

Recently I tried a more complicated form of INPUT. I wrote two simple programs. Both return erroneous results. I hope this will be fixed in the next version of the software as many other errors.
My programs:

EXPORT BUG0()
BEGIN
LOCAL A0,A1,A2;
PRINT();
INPUT({{A0,[−1]},{A1,1},A2},"title",{"l1","l2","l3"},{"h1","h2","h3"},{1,2,3},{11,12,13});
PRINT({A0,A1,A2})
END;

EXPORT BUG1()
BEGIN
LOCAL A0,A1,A2;
PRINT();
INPUT({{A0,[−1]},{A1,{"A","B"}},{A2,1}},"title",{"l1","l2","l3"},{"h1","h2","h3"});
PRINT({A0,A1,A2})
END;


RE: INPUT question - Giancarlo - 07-26-2014 02:06 PM

Hello,
I was playing with the input command and tested some checkboxes.

As ibdicated in the help menu it is possible to display checkboxes like this where you can flag both item:

LOCAL A, B;
INPUT ({{A, 1}, {B, 1}}, "title", {"black", "white"});

But it is possible to avoid that both checkboxes are flagged like here:

LOCAL A, B;
INPUT ({{A, 2}, {B, 2}}, "title", {"black", "white"});

But it is also possible to combined together more checkboxes with that option that gives the possibility to check one of the three colors and one of the two shapes:

LOCAL A, B, C, D, E;
INPUT ({{A, 3}, {B, 3}, {C, 3}, {D, 2}, {E, 2}}, "title", {"black", "grey", "white", "square", "circle"});

Very nice feature,

Giancarlo


RE: INPUT question - Giancarlo - 07-26-2014 02:22 PM

Just tested the multipage input form and it works. It is possible to have a different page title for each screen. Code tested:

LOCAL A, B, C, D, E, F, G;
LOCAL H, I, J, K, L, M, N;
LOCAL O, P, Q, R, S, T, U;
INPUT ({A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U}, {"PAGE ONE","PAGE TWO"});

As you can see i didn't mix the different input types (checkboxes, input boxes, drop down boxes) because i am still having problems with them...

Thanks

Giancarlo


RE: INPUT question - Giancarlo - 07-26-2014 02:40 PM

Hello,
Working on more complex input forms mixing the different types is another story.

So far i can write the code of a input form with input boxes, check boxes and dropdown boxes without sintax errors.

When i run the program graphically i can see the input form as designed and expected.

When i start assigning the data it happens sometimes that the calc reboot. In case it doesn't reboot, if i PRINT() the content of the variables they are wrong.

Any positive result on your side with complex input form? Would you mind sharing some code snippets?

Thanks

Giancarlo