Post Reply 
INPUT question
05-30-2014, 02:20 AM
Post: #1
INPUT question
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?
Visit this user's website Find all posts by this user
Quote this message in a reply
05-30-2014, 05:24 AM
Post: #2
RE: INPUT question
https://www.youtube.com/watch?v=WKKRqpbn...2XM4N8gi6w

http://mic.nic.free.fr - Youtube - Facebook
Find all posts by this user
Quote this message in a reply
05-30-2014, 12:05 PM
Post: #3
RE: INPUT question
(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.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-30-2014, 02:11 PM
Post: #4
RE: INPUT question
Hi there,
Is there documentation for the new input() function? Google has failed me so far.
Thanks
Find all posts by this user
Quote this message in a reply
05-31-2014, 02:11 AM
Post: #5
RE: INPUT question
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
Find all posts by this user
Quote this message in a reply
05-31-2014, 03:22 AM
Post: #6
RE: INPUT question
(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).
Visit this user's website Find all posts by this user
Quote this message in a reply
05-31-2014, 07:17 PM
Post: #7
RE: INPUT question
(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.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
06-02-2014, 02:12 PM
Post: #8
RE: INPUT question
(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.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
06-02-2014, 05:00 PM (This post was last modified: 06-02-2014 05:06 PM by Dougggg.)
Post: #9
RE: INPUT question
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
Find all posts by this user
Quote this message in a reply
06-02-2014, 07:34 PM
Post: #10
RE: INPUT question
(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.
Visit this user's website Find all posts by this user
Quote this message in a reply
06-02-2014, 09:01 PM (This post was last modified: 06-02-2014 09:02 PM by Mark Hardman.)
Post: #11
RE: INPUT question
(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;

   

HTH

Mark Hardman

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
06-02-2014, 10:30 PM (This post was last modified: 06-02-2014 10:31 PM by Mark Hardman.)
Post: #12
RE: INPUT question
(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:

   

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

   

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

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
07-13-2014, 12:21 PM
Post: #13
RE: INPUT question
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;
Find all posts by this user
Quote this message in a reply
07-26-2014, 02:06 PM
Post: #14
RE: INPUT question
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
Find all posts by this user
Quote this message in a reply
07-26-2014, 02:22 PM
Post: #15
RE: INPUT question
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
Find all posts by this user
Quote this message in a reply
07-26-2014, 02:40 PM
Post: #16
RE: INPUT question
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
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 3 Guest(s)