HP Forums
[help] input cmd - 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: [help] input cmd (/thread-7036.html)



[help] input cmd - compsystems - 10-14-2016 01:43 AM

Hello, the following code inquire two independent values each individually with INPUT CMD, the problem is that every time a value [ok] is entered the dialog box closes. the idea is to use the terminal view to show to request and input cmd to enter it

What I can do, to hold the dialog box?


Thank you

PHP Code:
export testInput()
begin
 local x1 
:= 0x2;
 print;
 print(
"Enter x1"); wait;
 if 
NOTinputx1 )) then killend;
 print(
x1); 

 print(
"Enter x2"); wait;
 if 
NOTinputx2 )) then killend;
 print(
x2);
 return 
"done";
end

in RPL the dialog box is retained.
PHP Code:
«
'initialValue' STO
'resetValue' STO
"Input"
{{ "x1:" "Enter Value for X1"  }}
1
resetValue 1 
->LIST
initialValue 1 
->LIST
INFORM
IF NOT THEN KILL END

"Input"
{{ "x2:" "Enter Value for X2"  }}
1
resetValue 1 LIST
initialValue 1 LIST
INFORM
IF NOT THEN KILL END
» 



RE: [help] input cmd - cyrille de brébisson - 10-14-2016 08:15 AM

Hello,

If your aim is to have a dialog box that takes inputs, and also display outputs (kind of like in a circular manner), the only way is to use the OK button to let the user tell you that he is done. Do your calculations (which will update the variables), and restart the input box.
Something along the lines of:

while 1 do
if not input(A) then break; end;
A:= A+1;
end;

Cyrille


RE: [help] input cmd - compsystems - 10-14-2016 02:20 PM

Thanks Cyrille

PHP Code:
export testInput()
begin
 local x1
:= 9x2:=8x3:=7x4:=6;
 print();
 print(
"Enter x1 value > "); wait();
 
//if NOT( input( x1 ) ) then kill; end;
 
while true do
  if 
NOTinputx1 ) ) then break; end;
 
end;
 print(
x1); 

 print(
"Enter x2 value > "); wait();
 
//if NOT( input( x2 ) ) then kill; end;
 
while true do
  if 
NOTinputx2 ) ) then break; end;
 
end;
 print(
x2);

 print(
"Enter x3, x4 values > "); wait();
 if 
NOTinput( { x3x4 } ) ) then killend;
 print(
x3);
 print(
x4);

 print(
"any key to continue");
 return 
"done";
end

It is a good trick =)
Code:
while true do if NOT( input( x2 )) then break; end; end;
The dialog box is called again, but the second run is necessary to press the [cancel] to exit =( and the [ok] key does not respond, also you lost the option to terminate the program =(
Code:
if NOT( input( x1 ) ) then kill; end;


I think the INPUT command for a single entry, the [OK] button should not execute the box, simply enter the data, a second [ok] executes it, just as is done with INFORM (HP48 / 50).
For multiple inputs [OK] button should to jump to the next entry

if NOT( input( { x3, x4 } ) ) then kill; end;

Another option or idea is add a new submenu
[Edit] [] [] [] [cancel] [ok] (current)->
[Edit] [ok] [] [] [cancel] [exe]
Good ideas?


PD: In the above code is required not in capital letters, I would like to accept it also in small letters for next uptated of firmware

There is a command to print without skip line? PRINT_LINE
I want to show the out, immediately after the input message.
print("Enter x2 value > ")
Enter x2 value > 8
and not
Enter x2 value >
8



RE: [help] input cmd - compsystems - 10-14-2016 02:57 PM

the third element and ... or parameter may be empty and automatically INPUT cmd adds identifiers and help string

PHP Code:
input({x1,x2},"input test", {}, {"Enter value for x1","Enter value for x2"} ); 
==
PHP Code:
input({x1,x2},"input test", {"x1:","x2:"}, {"Enter value for x1","Enter value for x2"} ); 
==
PHP Code:
input({x1,x2},"input test", {}, {} ); 
==
PHP Code:
input({x1,x2},"input test" );