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
Post Reply 




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