Redefining Keys: Multiple Conundrua
|
02-22-2014, 05:26 PM
(This post was last modified: 02-22-2014 08:56 PM by John R. Graham.)
Post: #1
|
|||
|
|||
Redefining Keys: Multiple Conundrua
Redefining keys with a special type of function is an interesting choice, the most surprising part of which is that the KEY functions merely feed a string of characters back to the entry line. Just as an exercise, I'm trying to redefine the LOG key to execute CSC (Cosecant). First attempt for RPN mode looked like this:
Code: KEY K_Log() Code: 1.4CSC(1) Now, second related issue. Say I wanted the key to behave correctly in both algebraic and RPN enrty modes. That's where the programmatic nature of the KEY functions could shine. The Entry variable from the home screen settings is global so I could return two different strings, depending on entry method. That would result in something like this: Code: KEY K_Log() Code: TAN() Now all this leads me to my third question. These little example programs to merely accomplish key reassignment (as yet incomplete or incorrect though they may be) have met or exceeded the size of many a useful little program I've written on other HP programmables. Shouldn't there be an easier way? - John |
|||
02-22-2014, 06:08 PM
Post: #2
|
|||
|
|||
RE: Redefining Keys: Multiple Conundrua
When you figure out how to successfully reprogram a key based on entry mode, please post an example.
Thanks. |
|||
02-23-2014, 03:55 AM
Post: #3
|
|||
|
|||
RE: Redefining Keys: Multiple Conundrua
You can extend the key definition to return the redefined command plus the keycode for the Enter key, which "activates" the string sent back. Using your example:
Code: KEY K_Log() I'm still experimenting, but it looks like you can build up a complex series of strings/or and keycodes and have pretty thorough control of what is sent back. Tim/Cyrille - any practical limits on what can be returned? Thanks for asking a good question prompting some fun research, and thanks to Han for a hint in an earlier post. --Bob Prosperi |
|||
02-23-2014, 12:33 PM
Post: #4
|
|||
|
|||
RE: Redefining Keys: Multiple Conundrua
Bob, did you try your example on the calculator? I've never seen a programming language where control flow passes through a RETURN construct like that and, in my own tests of your example, it didn't appear to.
- John |
|||
02-23-2014, 02:33 PM
Post: #5
|
|||
|
|||
RE: Redefining Keys: Multiple Conundrua
Yes, I too have problems with it now John.
It was indeed tested prior to posting. I normally will test something 3-4 times before posting, but on the Prime I test about 10 times first to be sure; in this case especially since the procedure is indeed so odd and counterintuitive. It worked until I changed my machine RPN->Textbook (and other settings, but don't recall the sequence) and doing some CAS stuff. I also modified the key settings PPL file for some other changes, to consolidate some settings. Gotta go figure out what settings and/or sequence work. Hope it's me and not a bug that mysteriously allowed it to work only long enough to complete the post. I hate when that happens. --Bob Prosperi |
|||
02-26-2014, 04:00 AM
Post: #6
|
|||
|
|||
RE: Redefining Keys: Multiple Conundrua
After much (!) testing there is good news and bad news about the technique I posted above.
The Good News: It does happen, so I'm not crazy. The Bad News: It only happens sometimes, most likely due to a bug, since I agree it isn't intuitive it should work that way. Starting with the CSC() argument on the stack (RPN mode per the original prblm) and this code: Code: KEY K_Tan() 6-7 out of 10 times, if you do this: Delete the slash characters in line 3 to remove comment and restore the command Press ESC to exit/compile the file Press HOME Press TAN to the invoke new assignment. Prime will insert the CSC(1) and execute the enter returning the CSC of the original argument to the stack. VERY USEFUL for creating key assignments, but unfortuntely, it's only a bug. Tim/Cyrille - it would be great if this bug could become a feature --Bob Prosperi |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)