Post Reply 
Simple programming help with the Prime
06-10-2014, 04:39 PM (This post was last modified: 06-10-2014 09:46 PM by Didier Lachieze.)
Post: #20
RE: Simple programming help with the Prime
(06-10-2014 02:10 PM)Angus Wrote:  KEY KS_Minus()
BEGIN
LOCAL reval;
retval:=tohex(1); //this gives an error when called without number of pops retval();
RETURN retval;
END;

However if I hit shift+minus the function app is started... Any ideas what I am doing wrong?

What happens is that tohex(1) returns #1h as 1 is not considered as an argument count but as a parameter for tohex().

Normally, according to the HP Prime User Guide when you define a USER Key the RETURN statement should be followed by a string containing the command to be put on the command line. (Btw it seems there is no way to execute automatically the string once it’s on the command line).

What’s interesting in your example is that retval is not a string but the number '1' and RETURN retlval; is activating the Symb function as if you had pressed the Symb key.

I’ve done a few tests and each key has a corresponding number which reproduces the key press including the execution of the function:
  • 0 to 50 for the unshifted key
    • 0 for the Apps key
    • 1 for the Symb key
    • 5 for the Home key
    • 6 for the Plot key
    • ..
    • 10 for the CAS key
    • 14 for the Vars key
    • ..
    • 50 for the + key,
  • 51 to 101 for the shifted keys
    • 51 for the Info key
    • 101 for the Ans key
  • 102 to 152 for the Alpha keys (upperscript)
    • 116 for the A key
    • ….
    • 152 for the ; key
  • 153 to 203 for the Alpha keys (lowerscript)
    • 167 for the a key
    • ….
    • 203 for the ; key

I don't know if that can be useful in any way ...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Simple programming help with the Prime - Didier Lachieze - 06-10-2014 04:39 PM



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