Post Reply 
Question about user mode key definitions.
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.
However, if I put a number on the input line and hit the key, the old definition is run instead.
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.

The user keys only seem to allow return as strings, so you could do:
KEY K_Minus()

This would place MBase(). On the input line and <enter> to run.

Or maybe:

KEY K_Minus()

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:


LOCAL men,m,m1,mx,my,s;
// initialize
UNTIL (m(1)==3 OR m(1)==7);
mx:=m(2); my:=m(3);
RETURN s:=(SETBASE(Ans(1),s-1));

(SETBASE(Ans(1),s-1)) takes input from the stack and converts to the base selected by the menu key given by s
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Question about user mode key definitions. - Stevetuc - 09-04-2017 05:57 PM

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