Post Reply 
Returning from a user-key function
09-14-2017, 08:00 PM
Post: #1
Returning from a user-key function
I've been tinkering with user keys to add some convenience functions, but I can't quite figure out how to return from them cleanly and consistently.

If you return a string, it treats that as a sequence of keys. If you return a number that's a valid key code, it treats it as pressing that key. If you return a number that's not a valid key code, it does the default function of the key that you actually pressed.

How do I set up a user key function that simply runs some routines, then returns with no simulated keystrokes? Suppose I wanted a user key function that does nothing but set the current base to hexadecimal (i.e. Base:=3), and can be used from any place where user keys are allowed, without any other side effects. What would that look like?
Visit this user's website Find all posts by this user
Quote this message in a reply
09-14-2017, 08:55 PM
Post: #2
RE: Returning from a user-key function
The following post may be what you're looking for:
Prime: Key Assignment
Find all posts by this user
Quote this message in a reply
09-14-2017, 09:40 PM
Post: #3
RE: Returning from a user-key function
(09-14-2017 08:55 PM)Didier Lachieze Wrote:  The following post may be what you're looking for:
Prime: Key Assignment

Hi Didier,

I saw that post earlier this afternoon. The key difference there is that they've used STARTVIEW to explicitly go back to the home screen. I'd like to be able to have a user key that can be used from any view (where user keys are allowed), and doesn't go back to home after use, and also doesn't issue any keystrokes upon completion. Am I overlooking some way of doing that?
Visit this user's website Find all posts by this user
Quote this message in a reply
09-14-2017, 09:50 PM
Post: #4
RE: Returning from a user-key function
What about returning an empty string ?

Code:
KEY K_Sq()
BEGIN
Base:=3;
RETURN "";
END;
Find all posts by this user
Quote this message in a reply
09-15-2017, 12:07 AM
Post: #5
RE: Returning from a user-key function
(09-14-2017 09:50 PM)Didier Lachieze Wrote:  What about returning an empty string ?

Code:
KEY K_Sq()
BEGIN
Base:=3;
RETURN "";
END;

That ALMOST does it, but you'll notice that it begins entry on the current input field. For example, do that on the home screen, and you'll see the cursor appear at input line.
Visit this user's website Find all posts by this user
Quote this message in a reply
09-15-2017, 05:11 AM
Post: #6
RE: Returning from a user-key function
(09-15-2017 12:07 AM)Dave Britten Wrote:  That ALMOST does it, but you'll notice that it begins entry on the current input field. For example, do that on the home screen, and you'll see the cursor appear at input line.

I'm wondering what would be a use case where this would be an issue, I'm missing what you're trying to achieve.
Find all posts by this user
Quote this message in a reply
09-15-2017, 02:53 PM
Post: #7
RE: Returning from a user-key function
(09-15-2017 05:11 AM)Didier Lachieze Wrote:  
(09-15-2017 12:07 AM)Dave Britten Wrote:  That ALMOST does it, but you'll notice that it begins entry on the current input field. For example, do that on the home screen, and you'll see the cursor appear at input line.

I'm wondering what would be a use case where this would be an issue, I'm missing what you're trying to achieve.

Yeah, it's kinda specific, but I'd like to know whether or not this is possible in case I run into situations where it does matter. Seems like the errant keystrokes could mess with something.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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