Post Reply 
Can I access keys by their names
08-26-2016, 06:19 PM
Post: #11
RE: Can I access keys by their names
(08-19-2016 02:57 PM)Fortin Wrote:  
(08-12-2016 06:33 PM)StephenG1CMZ Wrote:  Also possible, would be an option for keys not enabled to be ignored by GETKEY/ISKEYDOWN.

If the desire is for these functions to ignore key presses that you don't care about, then ISKEYDOWN may have new functionality that could help. ISKEYDOWN includes a feature in 10077 that returns a 64bit value (one bit per key) so you are able to see multiple key presses with one function call. If you then bitwise AND with a proper mask, you can filter out disabled keys.

For example, if you wanted to detect View (9) and Enter (30), you could create a mask of #40000200:64h (2^9 + 2^30). To create this mask, something like this works well: SETBASE(BITSL(#1b,9)+BITSL(#1b,30),4)

BITAND(ISKEYDOWN(-1),#40000200:64h) will return a mask containing only the keys of interest that are pressed.

Yes, that mask would do what I was thinking of when I suggested ignoring keys not enabled.
i had been thinking of a user interface more like ENABLEKEYS({4},True) or ENABLEKEYS({K_ESC},True) where True=ignore other keys, but ANDing a mask is good too.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Can I access keys by their names - StephenG1CMZ - 08-26-2016 06:19 PM



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