HP Forums

Full Version: INPUT question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
(05-30-2014 05:24 AM)Mic Wrote: [ -> ]https://www.youtube.com/watch?v=WKKRqpbn...2XM4N8gi6w

So it is best to keep the types of input (e.g. Checkboxes and prompts for numerical data) separate. Thanks.
Hi there,
Is there documentation for the new input() function? Google has failed me so far.
Thanks
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
(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/h...mmand.html

This covers some simple forms of INPUT: basic, type specification, checkboxes, and choose boxes (drop down boxes).
(05-31-2014 03:22 AM)Eddie W. Shore Wrote: [ -> ]Here is a some information regarding INPUT:

http://edspi31415.blogspot.com/2014/05/h...mmand.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.
(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.
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
(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.
(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
(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
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;
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
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
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
Reference URL's