CINP: Difference between revisions
No edit summary Tag: Undo |
No edit summary |
||
Line 10: | Line 10: | ||
* Return values are the same as the ones for [[INP]] when used to read keyboard input. See table below. | * Return values are the same as the ones for [[INP]] when used to read keyboard input. See table below. | ||
* Negative values returned indicate that a key was released or a lock function key has been turned off. | * Negative values returned indicate that a key was released or a lock function key has been turned off. | ||
* '''[[ | * '''[[Keywords currently not supported by QB64#Keywords not supported in Linux or macOS versions|Keyword not supported in Linux or macOS versions]]''' | ||
{{WhiteStart}}' '''Extended Keyboard Press Scancodes''' | {{WhiteStart}}' '''Extended Keyboard Press Scancodes''' | ||
' | ' | ||
'''' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SysReq ScrL Pause''' | '''' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SysReq ScrL Pause''' | ||
' 1 59 60 61 62 63 64 65 66 67 68 87 88 0 70 29 | ' 1 59 60 61 62 63 64 65 66 67 68 87 88 0 70 29 | ||
' '''`~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSpc Insert Home PgUp NumL / * -''' | ' '''`~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSpc Insert Home PgUp NumL / * -''' | ||
' 41 2 3 4 5 6 7 8 9 10 11 12 13 14 82 71 73 69 53 55 74 | ' 41 2 3 4 5 6 7 8 9 10 11 12 13 14 82 71 73 69 53 55 74 | ||
' '''Tab Q W E R T Y U I O P [{ ]} \| Delete End PgDn 7/Home 8/▲ 9/PU + ''' | ' '''Tab Q W E R T Y U I O P [{ ]} \| Delete End PgDn 7/Home 8/▲ 9/PU + ''' | ||
Line 25: | Line 25: | ||
' 42 44 45 46 47 48 49 50 51 52 53 54 72 79 80 81 '''e''' | ' 42 44 45 46 47 48 49 50 51 52 53 54 72 79 80 81 '''e''' | ||
' '''Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0/Insert ./Del r''' | ' '''Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0/Insert ./Del r''' | ||
' 29 {{text|91|purple}} 56 57 56 {{text|92 93|purple}} 29 75 80 77 82 83 28 | ' 29 {{text|91|purple}} 56 57 56 {{text|92 93|purple}} 29 75 80 77 82 83 28 | ||
' | ' | ||
{{WhiteEnd}} | {{WhiteEnd}} |
Revision as of 01:13, 23 January 2023
The _CINP function returns keyboard key press codes from a $CONSOLE window. Windows-only.
Syntax
- keycode& = _CINP
Description
- Return values are the same as the ones for INP when used to read keyboard input. See table below.
- Negative values returned indicate that a key was released or a lock function key has been turned off.
- Keyword not supported in Linux or macOS versions
Template:WhiteStart' Extended Keyboard Press Scancodes ' ' Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SysReq ScrL Pause ' 1 59 60 61 62 63 64 65 66 67 68 87 88 0 70 29 ' `~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ BkSpc Insert Home PgUp NumL / * - ' 41 2 3 4 5 6 7 8 9 10 11 12 13 14 82 71 73 69 53 55 74 ' Tab Q W E R T Y U I O P [{ ]} \| Delete End PgDn 7/Home 8/▲ 9/PU + ' 15 16 17 18 19 20 21 22 23 24 25 26 27 43 83 79 81 71 72 73 78 ' CapL A S D F G H J K L ;: '" Enter 4/◄- 5 6/-► E ' 58 30 31 32 33 34 35 36 37 38 39 40 28 75 76 77 n ' Shift Z X C V B N M ,< .> /? Shift ▲ 1/End 2/▼ 3/PD t ' 42 44 45 46 47 48 49 50 51 52 53 54 72 79 80 81 e ' Ctrl Win Alt Spacebar Alt Win Menu Ctrl ◄- ▼ -► 0/Insert ./Del r ' 29 91 56 57 56 92 93 29 75 80 77 82 83 28 ' Template:WhiteEnd
Examples
Example 1: Reading individual key strokes from a console window (Windows).
$CONSOLE:ONLY _DEST _CONSOLE: _SOURCE _CONSOLE PRINT "Press any key, and I'll give you the scan code for it. <ESC> quits the demo." PRINT PRINT DO x = _CONSOLEINPUT IF x = 1 THEN 'read only keyboard input ( = 1) c = _CINP PRINT c; END IF LOOP UNTIL c = 1 END |
See also