1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 13:50:36 +00:00

Better Shift key support for quick key codes

Now you can CTRL-K, hit SHIFT, then another key, and get the modified key code.  (Such as SHIFT-A would give 97 instead of 65, depending on CAPSLOCK state.)  A SHIFT down, then SHIFT up (without hitting  another key), returns the value for that SHIFT key.  (100303 or 100304, depending on which shift key was hit and released.)
This commit is contained in:
SteveMcNeill 2020-12-31 07:56:19 -05:00
parent 90ed1d7dce
commit 879e4cbd33

View file

@ -4885,6 +4885,7 @@ FUNCTION ide2 (ignore)
IF menu$(m, s) = "Insert Quick Keycode... Ctrl+K" THEN
ideQuickKeycode:
tempk$ = ""
DO: tempk = _KEYHIT: _LIMIT 30: LOOP UNTIL tempk = 0 'wait for key release
DO 'get the next key hit
PCOPY 3, 0
@ -4893,8 +4894,18 @@ FUNCTION ide2 (ignore)
tempk = _KEYHIT
IF tempk > 0 THEN tempk$ = STR$(tempk)
_LIMIT 30
LOOP UNTIL tempk$ <> ""
tempk$ = tempk$ + " "
LOOP UNTIL tempk > 0
IF tempk = 100303 OR tempk = 100304 THEN 'shift key
DO 'get the next key hit
PCOPY 3, 0
LOCATE idewy - 3, 2
PRINT "PRESS ANY KEY TO INSERT _KEYHIT/_KEYDOWN CODE"
tempk = _KEYHIT 'see what the next key is, and use it
IF tempk <> 0 THEN tempk$ = STR$(ABS(tempk)) 'if it's the SHFT UP code, then return the value for shift
_LIMIT 30
LOOP UNTIL tempk <> 0
END IF
tempk$ = _trim$(tempk$)
a$ = idegetline(idecy)
l$ = LEFT$(a$, idecx - 1): r$ = RIGHT$(a$, LEN(a$) - idecx + 1)
text$ = l$ + tempk$ + r$