[help] input cmd
10-14-2016, 01:43 AM (This post was last modified: 10-14-2016 02:11 AM by compsystems.)
Post: #1
 compsystems Senior Member Posts: 1,339 Joined: Dec 2013
[help] input cmd
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 := 0, x2; print; print("Enter x1"); wait; if NOT( input( x1 )) then kill; end; print(x1);  print("Enter x2"); wait; if NOT( input( x2 )) then kill; end; print(x2); return "done";end;

in RPL the dialog box is retained.
PHP Code:
«0 'initialValue' STO0 'resetValue' STO"Input"{{ "x1:" "Enter Value for X1"  }}1resetValue 1 ->LISTinitialValue 1 ->LISTINFORMIF NOT THEN KILL END"Input"{{ "x2:" "Enter Value for X2"  }}1resetValue 1 LISTinitialValue 1 LISTINFORMIF NOT THEN KILL END»
10-14-2016, 08:15 AM
Post: #2
 cyrille de brébisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: [help] input cmd
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
10-14-2016, 02:20 PM (This post was last modified: 10-14-2016 10:08 PM by compsystems.)
Post: #3
 compsystems Senior Member Posts: 1,339 Joined: Dec 2013
RE: [help] input cmd
Thanks Cyrille

PHP Code:
export testInput()begin local x1:= 9, x2:=8, x3:=7, x4:=6; print(); print("Enter x1 value > "); wait(); //if NOT( input( x1 ) ) then kill; end; while true do  if NOT( input( x1 ) ) then break; end; end; print(x1);  print("Enter x2 value > "); wait(); //if NOT( input( x2 ) ) then kill; end; while true do  if NOT( input( x2 ) ) then break; end; end; print(x2); print("Enter x3, x4 values > "); wait(); if NOT( input( { x3, x4 } ) ) then kill; end; 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;

 [] [] [] [cancel] [ok] (current)->
 [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
10-14-2016, 02:57 PM (This post was last modified: 10-14-2016 03:01 PM by compsystems.)
Post: #4
 compsystems Senior Member Posts: 1,339 Joined: Dec 2013
RE: [help] input cmd
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" );
 « Next Oldest | Next Newest »

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