The Museum of HP Calculators

HP Forum Archive 18

[ Return to Index | Top of Index ]

HP50g - Input with default value
Message #1 Posted by vq on 23 Oct 2008, 4:23 a.m.

I want my programs to show a default (current) value of a variable for input, so the user can just press ENTER to confirm and continue if he is happy with the value, just as it works on HP35S. Which way is the best? From the command reference, it seems that only INFORM allows me to define default values - is there a more simple way? Also, when creating the list with default values for INFORM, I need to fill the list with the current contents of the variables in question (the default values are not constant). How can I create a list which contains the values stored in variables? Say, having global variables X1, Y1 with values 1 and 10, I want to create a list containing {1 10}. Doing {X1 Y1} results in just that {X1 Y1}, the variables are not evaluated.

      
Re: HP50g - Input with default value
Message #2 Posted by C.Ret on 23 Oct 2008, 5:56 a.m.,
in response to message #1 by vq

Hello,

Yes { X1 Y1 } will be interpreted as { 1 10 } only in the case of local variable X1 and Y1, not for global.

One solution using INFORM option from X1 and Y1 as global variables will be as simple as crating a list contening the value of each variable like the following sequence :

X1 Y1 2 \->LIST
With X1 and Y1 storing respectively 1 and 10 you get exactly the { 1 10} list you are looking for your INFORM entry.

There is other alternative such as :

X1 Y1 { } + +

Edited: 23 Oct 2008, 5:58 a.m.

            
Re: HP50g - Input with default value
Message #3 Posted by V-PN on 23 Oct 2008, 6:57 a.m.,
in response to message #2 by C.Ret

 { X1 Y1 } XNUM { 1. 10. }
note that XNUM gives decimals and changes the mode to Approx.
BUT
you can use XNUM to { list { of { lists } } }
so it's the simplest method
also - IIRC
INFORM does not accept TYPE 29 (Integers)
                  
Re: HP50g - Input with default value
Message #4 Posted by vq on 23 Oct 2008, 7:20 a.m.,
in response to message #3 by V-PN

Thanks for all methods proposed, this solves the problem of list creation, works fine for the INFORM. However, using INFORM for such a trivial task as input od 1 real number is quite cumbersome. Is there a more simple way to get input with a proposed default value? For a repetitive use of a program when only some input values change, one can't require the user to re-enter all data.

                        
Re: HP50g - Input with default value
Message #5 Posted by C.Ret on 23 Oct 2008, 8:26 a.m.,
in response to message #4 by vq

A more simple method may be based on other 'user input function' such as INPUT, PROMPT or a simple HALT.

Exemple:

... X1 Y1 HALT ...
Show no information, the user have to know what to do and how to continue. 

... 1 "MODIFY x1 & CONT" PROMPT ... ... 10 "MODIFY x2 & CONT" PROMPT ... Some information is displaied, the calculator halt to let the user alter or conserve the stack. The user have also to know what to do and how to continue.

... "ENTER x1" X1 \->STR INPUT OBJ\-> .... ... "ENTER y1" Y1 \->STR INPUT OBJ\-> .... or ... "ENTER (x1,y1)" X1 Y1 R\->C \->STR INPUT OBJ\-> ... Information is display and program continue as soon as the user press ENTER

Other solutions may involve MENUs and TMENUs, every things are possible depending how you would like your(s) program(s) to interact with the user.

Edited: 23 Oct 2008, 9:34 a.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall