Post Reply 
Prime: Key Assignment
01-11-2014, 05:22 PM
Post: #1
Prime: Key Assignment
Hi,

Having read the manual (p 516/517) I was under the impression that all key assignments would do was to return a function or other text using the RETURN command. I played around using this command, but found it very difficult to make any key assignments of much use. Then when reading another message on the forum I was directed to an article on the comp.sys.hp48 where a person called Toby had made a short key assignment to scroll through Textbook, Algebra and RPN input settings.

To my surprise his method did not rely on the RETURN command at all, and still worked fine. As I have not found this being discussed elsewhere on the forum, I thought it worthwhile to mention, also that you can have several key assignments in one program file.

Below is an example key assignment file, that allows toggling between RPN and Textbook (I have not had occasion to use the Algebra setting at all so far) and also between Radians and Degrees, both in Home view.

I have kept the code in a file called User Keys

Code:

// Toggle switch RPN/Textbook
KEY K_On()
BEGIN
 IF Entry == 0  
  THEN Entry:=2 
  ELSE Entry:=0;
 END;
//Trick to refresh screen
STARTVIEW(−8,1);
STARTVIEW(−1,1); 
END;

// Toggle switch Deg/Radians in Home view
KEY K_Eex()
BEGIN
 IF HAngle == 0  
  THEN HAngle:=1 
  ELSE HAngle:=0;
 END;
//Trick to refresh screen
STARTVIEW(−8,1);
STARTVIEW(−1,1);
END;

Cheers, Terje
Find all posts by this user
Quote this message in a reply
01-11-2014, 09:02 PM
Post: #2
RE: Prime: Key Assignment
Yep, I've managed to make keys to change the angle mode, for example.

What we really need is the old KEYEVAL command, though. Outputting "+" is not the same as pressing the + button!

That said, one thing I do rather like about PPL KEY assignment is that it's pleasantly easy and transparent to do some things with keys that were a pain to do with UserRPL.
Find all posts by this user
Quote this message in a reply
01-11-2014, 10:38 PM
Post: #3
RE: Prime: Key Assignment
(01-11-2014 09:02 PM)The Shadow Wrote:  Yep, I've managed to make keys to change the angle mode, for example.

What we really need is the old KEYEVAL command, though. Outputting "+" is not the same as pressing the + button!

That said, one thing I do rather like about PPL KEY assignment is that it's pleasantly easy and transparent to do some things with keys that were a pain to do with UserRPL.

You can get the equivalent of keyeval by simply returning the key number.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-13-2014, 05:19 PM
Post: #4
RE: Prime: Key Assignment
(01-11-2014 10:38 PM)Han Wrote:  
(01-11-2014 09:02 PM)The Shadow Wrote:  Yep, I've managed to make keys to change the angle mode, for example.

What we really need is the old KEYEVAL command, though. Outputting "+" is not the same as pressing the + button!

That said, one thing I do rather like about PPL KEY assignment is that it's pleasantly easy and transparent to do some things with keys that were a pain to do with UserRPL.

You can get the equivalent of keyeval by simply returning the key number.

Hi Han,

How do you do that? Is it using the RETURN command? I cannot find any reference of that on the manual. I would like, for example, to send a ESC command at the end of a program.

Thanks and regards,

Miguel
Find all posts by this user
Quote this message in a reply
01-13-2014, 07:03 PM
Post: #5
RE: Prime: Key Assignment
(01-13-2014 05:19 PM)Miguel Toro Wrote:  Hi Han,

How do you do that? Is it using the RETURN command? I cannot find any reference of that on the manual. I would like, for example, to send a ESC command at the end of a program.

Thanks and regards,

Miguel

My post should probably have clarified that the keyeval effect was limited to the user keys. That is, one may redefine a user key by returning the keynumber. For example,

Code:

KEY K_7()
BEGIN
  RETURN(39);
END;

This turns the 7 key into the 6 key on the Home screen. You can put additional commands above the return(39) statement if you want to do some pre-processing before sending it over to the system keyhandler.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-13-2014, 10:19 PM
Post: #6
RE: Prime: Key Assignment
(01-13-2014 05:19 PM)Miguel Toro Wrote:  I would like, for example, to send a ESC command at the end of a program.

Thanks and regards,

Miguel

If by ESC you mean to clear the screen and return to Home after a User key has been used you can add the following two lines to the end of the Key definition:
Code:

//Trick to refresh screen
STARTVIEW(−8,1);
STARTVIEW(−1,1);

Maybe you were thinking of something different?

Cheers, Terje
Find all posts by this user
Quote this message in a reply
01-13-2014, 10:47 PM
Post: #7
RE: Prime: Key Assignment
Thank Han and Terje for your answers.

Regards,

Miguel
Find all posts by this user
Quote this message in a reply
12-14-2023, 11:05 AM
Post: #8
RE: Prime: Key Assignment
(01-13-2014 07:03 PM)Han Wrote:  
(01-13-2014 05:19 PM)Miguel Toro Wrote:  Hi Han,

How do you do that? Is it using the RETURN command? I cannot find any reference of that on the manual. I would like, for example, to send a ESC command at the end of a program.

Thanks and regards,

Miguel

My post should probably have clarified that the keyeval effect was limited to the user keys. That is, one may redefine a user key by returning the keynumber. For example,

Code:

KEY K_7()
BEGIN
  RETURN(39);
END;

This turns the 7 key into the 6 key on the Home screen. You can put additional commands above the return(39) statement if you want to do some pre-processing before sending it over to the system keyhandler.

How can I reset a previous wrong user-key assignment, such that in "User" mode (Shit Help, Shift Help) pressing that key reverts back to the standard key definition?
I wasn't able to find this on the User Manual.
Is it possible to remove a single user-key assignment? Or you must clear all them together? Or (even worse) you need reset the whole Prime calculator?
I have made some user-key assignments (in various different programs) that are permanently useful to me and so I normally stay in permanent User mode, but then I added assigned some wrong function ("propfrac()", to make it work in CAS environment similarly as in Home) to the K_Abc() key. Now, in this way, it doesn't work as desired in Home environment (showing floating numbers as fractions a/b or proper fractions a+b/c). I would tike to recover the original normal behavior.
As an aside question: where user-key assignments are stored on the HP Prime? Knowing that it would be easy to clear the relevant variable.
Another (different, but someway linked) question:
Inside a program, is there a way to know in which environment the Prime is currently set? i.e. to read a (possible) system variable, GET<something>, telling the current environment mode: Home or CAS?
Find all posts by this user
Quote this message in a reply
12-14-2023, 05:12 PM
Post: #9
RE: Prime: Key Assignment
Bonjour

Pour qu'une touche utilisateur en mode USER garde sa fonction de base
vous pouvez faire dans le programme d'assignation de celle-ci un 'RETURN -2;'
Pour aucune action c'est 'RETURN -1'.
Vous pouvez par exemple faire en sorte que selon certaines conditions une touche en mode
'USER' renvoie soit une nouvelle fonction, soit sa fonction de base soit rien.
Espérant que cela vous aide.

Hello

To ensure that a user key in USER mode retains its basic function
you can do a 'RETURN -2;' in the key assignment program.
For no action it's 'RETURN -1'.
You can, for example, make it so that, depending on certain conditions, a key in
USER' mode returns either a new function, its basic function or nothing.
Hope this helps.

Sorry for my english
Find all posts by this user
Quote this message in a reply
12-14-2023, 08:16 PM
Post: #10
RE: Prime: Key Assignment
You should be able to delete/remove the single key assignment wherever defined in one of the programs.
But finding in which program the key was assigned might require you to search each program (you can write a program to search each file for the key k_name ..) To prevent key assignments to be hidden, I place all key assignments in a single program like 'syskeys' to easily access them if needed.
Find all posts by this user
Quote this message in a reply
Post Reply 




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