mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-06 01:10:23 +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:
parent
90ed1d7dce
commit
879e4cbd33
|
@ -4885,6 +4885,7 @@ FUNCTION ide2 (ignore)
|
||||||
|
|
||||||
IF menu$(m, s) = "Insert Quick Keycode... Ctrl+K" THEN
|
IF menu$(m, s) = "Insert Quick Keycode... Ctrl+K" THEN
|
||||||
ideQuickKeycode:
|
ideQuickKeycode:
|
||||||
|
tempk$ = ""
|
||||||
DO: tempk = _KEYHIT: _LIMIT 30: LOOP UNTIL tempk = 0 'wait for key release
|
DO: tempk = _KEYHIT: _LIMIT 30: LOOP UNTIL tempk = 0 'wait for key release
|
||||||
DO 'get the next key hit
|
DO 'get the next key hit
|
||||||
PCOPY 3, 0
|
PCOPY 3, 0
|
||||||
|
@ -4893,8 +4894,18 @@ FUNCTION ide2 (ignore)
|
||||||
tempk = _KEYHIT
|
tempk = _KEYHIT
|
||||||
IF tempk > 0 THEN tempk$ = STR$(tempk)
|
IF tempk > 0 THEN tempk$ = STR$(tempk)
|
||||||
_LIMIT 30
|
_LIMIT 30
|
||||||
LOOP UNTIL tempk$ <> ""
|
LOOP UNTIL tempk > 0
|
||||||
tempk$ = tempk$ + " "
|
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)
|
a$ = idegetline(idecy)
|
||||||
l$ = LEFT$(a$, idecx - 1): r$ = RIGHT$(a$, LEN(a$) - idecx + 1)
|
l$ = LEFT$(a$, idecx - 1): r$ = RIGHT$(a$, LEN(a$) - idecx + 1)
|
||||||
text$ = l$ + tempk$ + r$
|
text$ = l$ + tempk$ + r$
|
||||||
|
|
Loading…
Reference in a new issue