Question about user mode key definitions.
|
09-03-2017, 10:53 PM
Post: #1
|
|||
|
|||
Question about user mode key definitions.
I call a function from a user mode key definition. When I clear the input line and put it in user mode and hit the key, the program is run.
However, if I put a number on the input line and hit the key, the old definition is run instead. Why? Note I'm redefining KS_Minus (the Base command) with a program that has a menu with hex, oct, bin, dec and exit as options. I want to have this program run when I hit shift-base and change the input line to the appropriate base. I have the menu part written, but the options (other than exit) don't do anything yet. So, the program runs if the input line is clear and I'm in user mode, but the original Base integer editor pops up instead if there is something on the input line. Thx -Donald |
|||
09-04-2017, 05:57 PM
(This post was last modified: 09-04-2017 06:11 PM by Stevetuc.)
Post: #2
|
|||
|
|||
RE: Question about user mode key definitions.
(09-03-2017 10:53 PM)webmasterpdx Wrote: I call a function from a user mode key definition. When I clear the input line and put it in user mode and hit the key, the program is run. The user keys only seem to allow return as strings, so you could do: KEY K_Minus() BEGIN "MBase()" END This would place MBase(). On the input line and <enter> to run. Or maybe: KEY K_Minus() BEGIN STRING(EVAL(MBase())) END; This will directly run MBase() evaluate the return and convert the returned argument to a string and place this ( without the quotes) on the input line. Press <enter> to place this on the stack or use any postfix operator as required to do math on result Here is the MBase code I am using with this: Code:
(SETBASE(Ans(1),s-1)) takes input from the stack and converts to the base selected by the menu key given by s |
|||
09-05-2017, 12:28 AM
Post: #3
|
|||
|
|||
RE: Question about user mode key definitions.
Did you actually try that out?
Shift-Base still seems to call the integer editor half the time....hard to figure out when it'll work. Also, using your formulae, it keeps giving me a result of 1, even though Ans is 6.... ??? |
|||
09-05-2017, 02:16 AM
Post: #4
|
|||
|
|||
RE: Question about user mode key definitions.
you can only run this in Cas mode, as it runs the integer editor in home mode.
however, it uses the stack from home mode, which is really weird....that's why I was getting 1... ... |
|||
09-05-2017, 02:56 AM
(This post was last modified: 09-05-2017 02:56 AM by Tim Wessman.)
Post: #5
|
|||
|
|||
RE: Question about user mode key definitions.
Just use Ans as a variable (no parens). That will be the home Ans last item.
TW Although I work for HP, the views and opinions I post here are my own. |
|||
09-05-2017, 03:50 AM
Post: #6
|
|||
|
|||
RE: Question about user mode key definitions.
The problem is you can't really use KS_Minus as the key to override....for some reason.
If I use KA_3 (Alpha 3), it works....in home mode. |
|||
09-05-2017, 04:23 AM
Post: #7
|
|||
|
|||
RE: Question about user mode key definitions.
(09-05-2017 12:28 AM)webmasterpdx Wrote: Did you actually try that out? ... Yes I did try it out! The key definitions for K_Minus ( not KS_Minus) I used both work fine. KS_Minus does have the problems you report. |
|||
09-05-2017, 06:05 AM
(This post was last modified: 09-05-2017 06:06 AM by leprechaun.)
Post: #8
|
|||
|
|||
RE: Question about user mode key definitions.
Quote:I want to have this program run when I hit shift-base and change the input line to the appropriate base. I miss this possibility, too. There will be reasons why such little things are or had been ignored. These little feature improve the usability very much. My approach is something like that. (SoftMenu() is a menu-laucher that returns the softkey id) The additional two ENTERs seem to be unavoidable. Is it possible to take input from the command line instead of the stack? so purge a number from input and save ENTERing it to the stack. Code: SymbBaseMenu() Prime and I are a love-hate. I dig out the prime occasionally but only for playing with it. The productivity level is frustratingly low for me. Maybe that is because I work as a hardware designer with lowest level firmware on the software side. Script-languages and HPPPL seem to be too complicated for me. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)