HP50g - Input with default value



#6

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.


#7

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.


#8

 { 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)

#9

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.


#10

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.


Possibly Related Threads...
Thread Author Replies Views Last Post
  INPUT for HP Prime Eddie W. Shore 3 1,095 11-17-2013, 04:46 PM
Last Post: Michael de Estrada
  HP Prime Tutorial #4 is up (CASE/CHOOSE/INPUT) Eddie W. Shore 1 849 11-15-2013, 07:32 AM
Last Post: Davi Ribeiro de Oliveira
  HP Prime Programming Tutorial #3: WHILE, INPUT, KILL, REPEAT, GETKEY Eddie W. Shore 5 1,561 11-07-2013, 12:25 AM
Last Post: Han
  minor visual bug in INPUT Han 0 649 10-03-2013, 01:13 PM
Last Post: Han
  hp50g screen weird line Sok-khieng Chum Hun 2 1,018 09-10-2013, 08:11 AM
Last Post: Sok-khieng Chum Hun
  Documentation about Hp50g / 49g+ / 48gII and wikis Pier Aiello 9 2,091 09-10-2013, 04:22 AM
Last Post: Software49g
  Input syntax on the Prime Gilles Carpentier 6 1,496 08-23-2013, 04:31 AM
Last Post: Gilles Carpentier
  Input CAS var on HP Prime Mic 2 922 08-22-2013, 02:29 PM
Last Post: Mic
  "A Penny for your thoughts" on the HP50g Tom Grydeland 3 1,190 08-01-2013, 03:57 AM
Last Post: Les Koller
  Is there a HP50g emulator for Linux? Matti Övermark 2 1,002 07-03-2013, 07:40 AM
Last Post: Matti Övermark

Forum Jump: