HP Forums
how to scroll Terminal and return to a choice? - 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: how to scroll Terminal and return to a choice? (/thread-4254.html)



how to scroll Terminal and return to a choice? - salvomic - 06-29-2015 07:37 AM

hi,
I've a long Terminal list (or a screen with TEXTOUT, long).
I need to prevent to exit from Terminal (or graphic) touching the screen (now it ends Terminal).
Otherwise it would ok a way to save Terminal "as is" in a variable...

I was use a code like this structure:
Code:

whattodo() // function with CHOOSE()
BEGIN
LOCAL ch;
CHOOSE ch;
//...
END;

// foo()
// present data in Terminal, user scroll to read all
BEGIN
//...
FREEZE();
WAIT;
whattodo();
END;



RE: how to scroll Terminal and return to a choice? - salvomic - 06-29-2015 11:04 PM

for now I'm finding only a workaround:

to insert this code
Code:

WAIT();
PRINT(); // to clear the previous page of Terminal...

among the various groups of PRINT(); lines, to simulate a pagination.
But that works only if the user doesn't touch the screen, otherwise the program exit from Terminal and go on with the other commands...
Enter (or other key or paddle) is ok...

I need, however, something more stable and ...elegant, please.

Salvo


RE: how to scroll Terminal and return to a choice? - jkiriosd - 06-30-2015 02:53 AM

Hi salvomic, i hope this can help you. Just ctrl+c and ctrl +v and test.

Code:

LOCAL VAR1,VAR2;VAR3;
HOJA1();
HOJA2();
HOJA3();

HOJA1()
BEGIN
PRINT();
PRINT("HOLA MUNDO");
PRINT("");
PRINT("VAR1 ="+VAR1);
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("USE THE ARROW KEYS TO MOVE TO THE NEXT PAGE");
PRINT("                                                                         ->");
REPEAT
K:=GETKEY;
IF K==8 THEN
RETURN HOJA2();
END;
IF K==4 THEN
STARTVIEW(-7,1);
KILL;
END
UNTIL
A==1;
END;


HOJA2()
BEGIN
PRINT();
PRINT("");
PRINT("HOLA MUNDO");
PRINT("");
PRINT("VAR2 ="+VAR2);
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("USE THE ARROW KEYS TO SCROLL BETWEEN PAGES");
PRINT("<-                                                                      ->");

REPEAT
K:=GETKEY;
IF K==7 THEN
RETURN HOJA1();
END;
IF K==8 THEN
RETURN HOJA3();
END;
IF K==4 THEN
STARTVIEW(-7,1);
KILL;
END
UNTIL
A==1;
END;


HOJA3()
BEGIN
PRINT();
PRINT();
PRINT("");
PRINT("");
PRINT("HOLA MUNDO");
PRINT("");
PRINT("VAR3 ="+VAR3);
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("TO END THE PROGRAM PRESS ESC TWO TIMES.");
PRINT("<-");

REPEAT
K:=GETKEY;
IF K==7 THEN
RETURN HOJA2();
END;
IF K==4 THEN
STARTVIEW(-7,1);
KILL;
END;
UNTIL
A==1;
END;


EXPORT TEST()
BEGIN
A:=0;
INPUT(VAR1);
INPUT(VAR2);
INPUT(VAR3);
RETURN HOJA1();
END;

I have a problem with this code, i am sure you will have the same problem soon. Is not a big problem but i hope to solved this some day.

Sorry for my bad english, i dont speak english very well.


RE: how to scroll Terminal and return to a choice? - salvomic - 06-30-2015 07:02 AM

(06-30-2015 02:53 AM)jkiriosd Wrote:  Hi salvomic, i hope this can help you. Just ctrl+c and ctrl +v and test.

Code:

LOCAL VAR1,VAR2;VAR3;
HOJA1();
...

I have a problem with this code, i am sure you will have the same problem soon. Is not a big problem but i hope to solved this some day.

Sorry for my bad english, i dont speak english very well.

hola,
your code had some errors...
better so:
Code:

HOJA1();
HOJA2();
HOJA3();

EXPORT HOJA1()
BEGIN
LOCAL VAR1,VAR2,VAR3;

PRINT();
PRINT("HOLA MUNDO");
PRINT("");
PRINT("VAR1 ="+VAR1);
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("USE THE ARROW KEYS TO MOVE TO THE NEXT PAGE");
PRINT("                                                                         ->");
REPEAT
K:=GETKEY;
IF K==8 THEN
RETURN HOJA2();
END;
IF K==4 THEN
STARTVIEW(-7,1);
KILL;
END
UNTIL
A==1;
END;


HOJA2()
BEGIN
LOCAL VAR2;
PRINT();
PRINT("");
PRINT("HOLA MUNDO");
PRINT("");
PRINT("VAR2 ="+VAR2);
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("USE THE ARROW KEYS TO SCROLL BETWEEN PAGES");
PRINT("<-                                                                      ->");

REPEAT
K:=GETKEY;
IF K==7 THEN
RETURN HOJA1();
END;
IF K==8 THEN
RETURN HOJA3();
END;
IF K==4 THEN
STARTVIEW(-7,1);
KILL;
END
UNTIL
A==1;
END;


HOJA3()
BEGIN
LOCAL VAR3;
PRINT();
PRINT();
PRINT("");
PRINT("");
PRINT("HOLA MUNDO");
PRINT("");
PRINT("VAR3 ="+VAR3);
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("");
PRINT("TO END THE PROGRAM PRESS ESC TWO TIMES.");
PRINT("<-");

REPEAT
K:=GETKEY;
IF K==7 THEN
RETURN HOJA2();
END;
IF K==4 THEN
STARTVIEW(-7,1);
KILL;
END;
UNTIL
A==1;
END;


EXPORT TEST()
BEGIN
LOCAL VAR1, VAR2, VAR3;
// A:=0;
INPUT(VAR1);
INPUT(VAR2);
INPUT(VAR3);
RETURN HOJA1();
END;

it seems to work now. But I shall tray if something like this works also when in a program there is CHOOSE, MSGBOX or other controls that interfere with screens...

A little advice: programming don't use "all uppercase" name for variables (they could be some reserved words with the same name...)

Salvo