-
Notifications
You must be signed in to change notification settings - Fork 204
/
gtkeys.prg
366 lines (350 loc) · 20.9 KB
/
gtkeys.prg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
/*
* demonstration/test code for GT keyboard input
*
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
*
*/
#include "inkey.ch"
#ifdef __HARBOUR__
#include "hbgtinfo.ch"
REQUEST HB_CODEPAGE_PLMAZ
REQUEST HB_CODEPAGE_PLISO
REQUEST HB_CODEPAGE_PL852
REQUEST HB_CODEPAGE_PLWIN
REQUEST HB_CODEPAGE_UTF8EX
#else
#xtranslate hb_keyStd( <n> ) => ( <n> )
#xtranslate hb_keyCode( <n> ) => Asc( <n> )
#xtranslate hb_keyChar( <c> ) => iif( <c> >= 32 .AND. <c> <= 255 .AND. <c> != 127, Chr( <c> ), "" )
#xtranslate hb_ntos( <n> ) => LTrim( Str( <n> ) )
#endif
#ifndef HB_K_RESIZE
#define HB_K_RESIZE 1101
#endif
PROCEDURE Main( cTermCP, cHostCP, lBoxChar, lRawKey )
LOCAL k, kX, i, s
LOCAL aKeys := { ;
{ "K_UP", 5, "Up arrow, Ctrl-E" }, ;
{ "K_DOWN", 24, "Down arrow, Ctrl-X" }, ;
{ "K_LEFT", 19, "Left arrow, Ctrl-S" }, ;
{ "K_RIGHT", 4, "Right arrow, Ctrl-D" }, ;
{ "K_HOME", 1, "Home, Ctrl-A" }, ;
{ "K_END", 6, "End, Ctrl-F" }, ;
{ "K_PGUP", 18, "PgUp, Ctrl-R" }, ;
{ "K_PGDN", 3, "PgDn, Ctrl-C" }, ;
{ "K_CTRL_UP", 397, "Ctrl-Up arrow" }, ;
{ "K_CTRL_DOWN", 401, "Ctrl-Down arrow" }, ;
{ "K_CTRL_LEFT", 26, "Ctrl-Left arrow, Ctrl-Z" }, ;
{ "K_CTRL_RIGHT", 2, "Ctrl-Right arrow, Ctrl-B" }, ;
{ "K_CTRL_HOME", 29, "Ctrl-Home, Ctrl-]" }, ;
{ "K_CTRL_END", 23, "Ctrl-End, Ctrl-W" }, ;
{ "K_CTRL_PGUP", 31, "Ctrl-PgUp, Ctrl-Hyphen" }, ;
{ "K_CTRL_PGDN", 30, "Ctrl-PgDn, Ctrl-^" }, ;
{ "K_ALT_UP", 408, "Alt-Up arrow" }, ;
{ "K_ALT_DOWN", 416, "Alt-Down arrow" }, ;
{ "K_ALT_LEFT", 411, "Alt-Left arrow" }, ;
{ "K_ALT_RIGHT", 413, "Alt-Right arrow" }, ;
{ "K_ALT_HOME", 407, "Alt-Home" }, ;
{ "K_ALT_END", 415, "Alt-End" }, ;
{ "K_ALT_PGUP", 409, "Alt-PgUp" }, ;
{ "K_ALT_PGDN", 417, "Alt-PgDn" }, ;
{ "K_ENTER", 13, "Enter, Ctrl-M" }, ;
{ "K_RETURN", 13, "Return, Ctrl-M" }, ;
{ "K_SPACE", 32, "Space bar" }, ;
{ "K_ESC", 27, "Esc, Ctrl-[" }, ;
{ "K_CTRL_ENTER", 10, "Ctrl-Enter, Ctrl-J" }, ;
{ "K_CTRL_RETURN", 10, "Ctrl-Return, Ctrl-J" }, ;
{ "K_CTRL_RET", 10, "Ctrl-Return (Compat.)" }, ;
{ "K_CTRL_PRTSCR", 379, "Ctrl-Print Screen, Alt-4" }, ;
{ "K_ALT_COMMA", 307, "Alt-," }, ;
{ "K_ALT_PERIOD", 308, "Alt-." }, ;
{ "K_CTRL_QUESTION", 309, "Ctrl-?, Alt-Slash" }, ;
{ "K_ALT_SLASH", 309, "Alt-Slash" }, ;
{ "K_ALT_BACKSLASH", 299, "Alt-Backslash" }, ;
{ "K_ALT_ENTER", 284, "Alt-Enter" }, ;
{ "K_ALT_RETURN", 284, "Alt-Return" }, ;
{ "K_ALT_MINUS", 386, "Alt-Minus" }, ;
{ "K_ALT_EQUALS", 387, "Alt-Equals" }, ;
{ "K_ALT_ESC", 257, "Alt-Esc" }, ;
{ "K_ALT_BACKQUOTE", 297, "Alt-backquote" }, ;
{ "K_ALT_OSB", 282, "Alt-[" }, ;
{ "K_ALT_CSB", 283, "Alt-]" }, ;
{ "K_ALT_SC", 295, "Alt-;" }, ;
{ "K_ALT_QUOTE", 296, "Alt-'" }, ;
{ "KP_CENTER", 332, "Keypad CENTER (5)" }, ;
{ "KP_ALT_ENTER", 422, "Keypad Alt-Enter" }, ;
{ "KP_CTRL_5", 399, "Keypad Ctrl-5" }, ;
{ "KP_CTRL_SLASH", 405, "Keypad Ctrl-/" }, ;
{ "KP_CTRL_ASTERISK", 406, "Keypad Ctrl-*" }, ;
{ "KP_CTRL_MINUS", 398, "Keypad Ctrl--" }, ;
{ "KP_CTRL_PLUS", 400, "Keypad Ctrl-+" }, ;
{ "KP_ALT_5", 5, "Keypad Alt-5" }, ;
{ "KP_ALT_SLASH", 420, "Keypad Alt-/" }, ;
{ "KP_ALT_ASTERISK", 311, "Keypad Alt-*" }, ;
{ "KP_ALT_MINUS", 330, "Keypad Alt--" }, ;
{ "KP_ALT_PLUS", 334, "Keypad Alt-+" }, ;
{ "K_INS", 22, "Ins, Ctrl-V" }, ;
{ "K_DEL", 7, "Del, Ctrl-G" }, ;
{ "K_BS", 8, "Backspace, Ctrl-H" }, ;
{ "K_SH_BS", 423, "Shift-Backspace, Ctrl-Shift-Tab" }, ;
{ "K_CTRL_SH_TAB", 423, "Ctrl-Shift-Tab" }, ;
{ "K_TAB", 9, "Tab, Ctrl-I" }, ;
{ "K_SH_TAB", 271, "Shift-Tab" }, ;
{ "K_CTRL_INS", 402, "Ctrl-Ins" }, ;
{ "K_CTRL_DEL", 403, "Ctrl-Del" }, ;
{ "K_CTRL_BS", 127, "Ctrl-Backspace" }, ;
{ "K_CTRL_TAB", 404, "Ctrl-Tab" }, ;
{ "K_ALT_INS", 418, "Alt-Ins" }, ;
{ "K_ALT_DEL", 419, "Alt-Del" }, ;
{ "K_ALT_BS", 270, "Alt-Backspace" }, ;
{ "K_ALT_TAB", 421, "Alt-Tab" } }
AAdd( aKeys, { "K_CTRL_A", 1, "Ctrl-A, Home" } )
AAdd( aKeys, { "K_CTRL_B", 2, "Ctrl-B, Ctrl-Right arrow" } )
AAdd( aKeys, { "K_CTRL_C", 3, "Ctrl-C, PgDn, Ctrl-ScrollLock" } )
AAdd( aKeys, { "K_CTRL_D", 4, "Ctrl-D, Right arrow" } )
AAdd( aKeys, { "K_CTRL_E", 5, "Ctrl-E, Up arrow" } )
AAdd( aKeys, { "K_CTRL_F", 6, "Ctrl-F, End" } )
AAdd( aKeys, { "K_CTRL_G", 7, "Ctrl-G, Del" } )
AAdd( aKeys, { "K_CTRL_H", 8, "Ctrl-H, Backspace" } )
AAdd( aKeys, { "K_CTRL_I", 9, "Ctrl-I, Tab" } )
AAdd( aKeys, { "K_CTRL_J", 10, "Ctrl-J" } )
AAdd( aKeys, { "K_CTRL_K", 11, "Ctrl-K" } )
AAdd( aKeys, { "K_CTRL_L", 12, "Ctrl-L" } )
AAdd( aKeys, { "K_CTRL_M", 13, "Ctrl-M, Return" } )
AAdd( aKeys, { "K_CTRL_N", 14, "Ctrl-N" } )
AAdd( aKeys, { "K_CTRL_O", 15, "Ctrl-O" } )
AAdd( aKeys, { "K_CTRL_P", 16, "Ctrl-P" } )
AAdd( aKeys, { "K_CTRL_Q", 17, "Ctrl-Q" } )
AAdd( aKeys, { "K_CTRL_R", 18, "Ctrl-R, PgUp" } )
AAdd( aKeys, { "K_CTRL_S", 19, "Ctrl-S, Left arrow" } )
AAdd( aKeys, { "K_CTRL_T", 20, "Ctrl-T" } )
AAdd( aKeys, { "K_CTRL_U", 21, "Ctrl-U" } )
AAdd( aKeys, { "K_CTRL_V", 22, "Ctrl-V, Ins" } )
AAdd( aKeys, { "K_CTRL_W", 23, "Ctrl-W, Ctrl-End" } )
AAdd( aKeys, { "K_CTRL_X", 24, "Ctrl-X, Down arrow" } )
AAdd( aKeys, { "K_CTRL_Y", 25, "Ctrl-Y" } )
AAdd( aKeys, { "K_CTRL_Z", 26, "Ctrl-Z, Ctrl-Left arrow" } )
AAdd( aKeys, { "K_ALT_A", 286, "Alt-A" } )
AAdd( aKeys, { "K_ALT_B", 304, "Alt-B" } )
AAdd( aKeys, { "K_ALT_C", 302, "Alt-C" } )
AAdd( aKeys, { "K_ALT_D", 288, "Alt-D" } )
AAdd( aKeys, { "K_ALT_E", 274, "Alt-E" } )
AAdd( aKeys, { "K_ALT_F", 289, "Alt-F" } )
AAdd( aKeys, { "K_ALT_G", 290, "Alt-G" } )
AAdd( aKeys, { "K_ALT_H", 291, "Alt-H" } )
AAdd( aKeys, { "K_ALT_I", 279, "Alt-I" } )
AAdd( aKeys, { "K_ALT_J", 292, "Alt-J" } )
AAdd( aKeys, { "K_ALT_K", 293, "Alt-K" } )
AAdd( aKeys, { "K_ALT_L", 294, "Alt-L" } )
AAdd( aKeys, { "K_ALT_M", 306, "Alt-M" } )
AAdd( aKeys, { "K_ALT_N", 305, "Alt-N" } )
AAdd( aKeys, { "K_ALT_O", 280, "Alt-O" } )
AAdd( aKeys, { "K_ALT_P", 281, "Alt-P" } )
AAdd( aKeys, { "K_ALT_Q", 272, "Alt-Q" } )
AAdd( aKeys, { "K_ALT_R", 275, "Alt-R" } )
AAdd( aKeys, { "K_ALT_S", 287, "Alt-S" } )
AAdd( aKeys, { "K_ALT_T", 276, "Alt-T" } )
AAdd( aKeys, { "K_ALT_U", 278, "Alt-U" } )
AAdd( aKeys, { "K_ALT_V", 303, "Alt-V" } )
AAdd( aKeys, { "K_ALT_W", 273, "Alt-W" } )
AAdd( aKeys, { "K_ALT_X", 301, "Alt-X" } )
AAdd( aKeys, { "K_ALT_Y", 277, "Alt-Y" } )
AAdd( aKeys, { "K_ALT_Z", 300, "Alt-Z" } )
AAdd( aKeys, { "K_ALT_1", 376, "Alt-1" } )
AAdd( aKeys, { "K_ALT_2", 377, "Alt-2" } )
AAdd( aKeys, { "K_ALT_3", 378, "Alt-3" } )
AAdd( aKeys, { "K_ALT_4", 379, "Alt-4" } )
AAdd( aKeys, { "K_ALT_5", 380, "Alt-5" } )
AAdd( aKeys, { "K_ALT_6", 381, "Alt-6" } )
AAdd( aKeys, { "K_ALT_7", 382, "Alt-7" } )
AAdd( aKeys, { "K_ALT_8", 383, "Alt-8" } )
AAdd( aKeys, { "K_ALT_9", 384, "Alt-9" } )
AAdd( aKeys, { "K_ALT_0", 385, "Alt-0" } )
AAdd( aKeys, { "K_F1", 28, "F1, Ctrl-Backslash" } )
AAdd( aKeys, { "K_F2", -1, "F2" } )
AAdd( aKeys, { "K_F3", -2, "F3" } )
AAdd( aKeys, { "K_F4", -3, "F4" } )
AAdd( aKeys, { "K_F5", -4, "F5" } )
AAdd( aKeys, { "K_F6", -5, "F6" } )
AAdd( aKeys, { "K_F7", -6, "F7" } )
AAdd( aKeys, { "K_F8", -7, "F8" } )
AAdd( aKeys, { "K_F9", -8, "F9" } )
AAdd( aKeys, { "K_F10", -9, "F10" } )
AAdd( aKeys, { "K_F11", -40, "F11" } )
AAdd( aKeys, { "K_F12", -41, "F12" } )
AAdd( aKeys, { "K_CTRL_F1", -20, "Ctrl-F1" } )
AAdd( aKeys, { "K_CTRL_F2", -21, "Ctrl-F2" } )
AAdd( aKeys, { "K_CTRL_F3", -22, "Ctrl-F4" } )
AAdd( aKeys, { "K_CTRL_F4", -23, "Ctrl-F3" } )
AAdd( aKeys, { "K_CTRL_F5", -24, "Ctrl-F5" } )
AAdd( aKeys, { "K_CTRL_F6", -25, "Ctrl-F6" } )
AAdd( aKeys, { "K_CTRL_F7", -26, "Ctrl-F7" } )
AAdd( aKeys, { "K_CTRL_F8", -27, "Ctrl-F8" } )
AAdd( aKeys, { "K_CTRL_F9", -28, "Ctrl-F9" } )
AAdd( aKeys, { "K_CTRL_F10", -29, "Ctrl-F10" } )
AAdd( aKeys, { "K_CTRL_F11", -44, "Ctrl-F11" } )
AAdd( aKeys, { "K_CTRL_F12", -45, "Ctrl-F12" } )
AAdd( aKeys, { "K_ALT_F1", -30, "Alt-F1" } )
AAdd( aKeys, { "K_ALT_F2", -31, "Alt-F2" } )
AAdd( aKeys, { "K_ALT_F3", -32, "Alt-F3" } )
AAdd( aKeys, { "K_ALT_F4", -33, "Alt-F4" } )
AAdd( aKeys, { "K_ALT_F5", -34, "Alt-F5" } )
AAdd( aKeys, { "K_ALT_F6", -35, "Alt-F6" } )
AAdd( aKeys, { "K_ALT_F7", -36, "Alt-F7" } )
AAdd( aKeys, { "K_ALT_F8", -37, "Alt-F8" } )
AAdd( aKeys, { "K_ALT_F9", -38, "Alt-F9" } )
AAdd( aKeys, { "K_ALT_F10", -39, "Alt-F10" } )
AAdd( aKeys, { "K_ALT_F11", -46, "Alt-F11" } )
AAdd( aKeys, { "K_ALT_F12", -47, "Alt-F12" } )
AAdd( aKeys, { "K_SH_F1", -10, "Shift-F1" } )
AAdd( aKeys, { "K_SH_F2", -11, "Shift-F2" } )
AAdd( aKeys, { "K_SH_F3", -12, "Shift-F3" } )
AAdd( aKeys, { "K_SH_F4", -13, "Shift-F4" } )
AAdd( aKeys, { "K_SH_F5", -14, "Shift-F5" } )
AAdd( aKeys, { "K_SH_F6", -15, "Shift-F6" } )
AAdd( aKeys, { "K_SH_F7", -16, "Shift-F7" } )
AAdd( aKeys, { "K_SH_F8", -17, "Shift-F8" } )
AAdd( aKeys, { "K_SH_F9", -18, "Shift-F9" } )
AAdd( aKeys, { "K_SH_F10", -19, "Shift-F10" } )
AAdd( aKeys, { "K_SH_F11", -42, "Shift-F11" } )
AAdd( aKeys, { "K_SH_F12", -43, "Shift-F12" } )
AAdd( aKeys, { "K_MOUSEMOVE", 1001, "mouse move" } )
AAdd( aKeys, { "K_LBUTTONDOWN", 1002, "mouse left button down" } )
AAdd( aKeys, { "K_LBUTTONUP", 1003, "mouse left button up" } )
AAdd( aKeys, { "K_RBUTTONDOWN", 1004, "mouse right button down" } )
AAdd( aKeys, { "K_RBUTTONUP", 1005, "mouse right button up" } )
AAdd( aKeys, { "K_LDBLCLK", 1006, "mouse left button double click" } )
AAdd( aKeys, { "K_RDBLCLK", 1007, "mouse right button double click" } )
AAdd( aKeys, { "K_MBUTTONDOWN", 1008, "mouse middle button down" } )
AAdd( aKeys, { "K_MBUTTONUP", 1009, "mouse middle button up" } )
AAdd( aKeys, { "K_MDBLCLK", 1010, "mouse middle button double click" } )
AAdd( aKeys, { "K_MMLEFTDOWN", 1011, "Mouse Move Left Down" } )
AAdd( aKeys, { "K_MMRIGHTDOWN", 1012, "Mouse Move Right Down" } )
AAdd( aKeys, { "K_MMMIDDLEDOWN", 1013, "Mouse Move Middle Down" } )
AAdd( aKeys, { "K_MWFORWARD", 1014, "Mouse Wheel Forward" } )
AAdd( aKeys, { "K_MWBACKWARD", 1015, "Mouse Wheel Backward" } )
AAdd( aKeys, { "K_NCMOUSEMOVE", 1016, "Non-Client Area Mouse Movement" } )
AAdd( aKeys, { "HB_K_RESIZE", 1101, "screen dimension changed" } )
AAdd( aKeys, { "HB_K_CLOSE", 1102, "close button hit" } )
AAdd( aKeys, { "HB_K_GOTFOCUS", 1103, "focus restored" } )
AAdd( aKeys, { "HB_K_LOSTFOCUS", 1104, "focus lost" } )
AAdd( aKeys, { "HB_K_CONNECT", 1105, "remote terminal connected" } )
AAdd( aKeys, { "HB_K_DISCONNECT", 1106, "remote terminal disconnected" } )
AAdd( aKeys, { "HB_K_TERMINATE", 1107, "terminate signal from system" } )
AAdd( aKeys, { "HB_K_MENU", 1108, "MENU key pressed" } )
#ifdef __HARBOUR__
Set( _SET_EVENTMASK, HB_INKEY_ALL + HB_INKEY_EXT )
hb_gtInfo( HB_GTI_CURSORBLINKRATE, 1000 )
hb_gtInfo( HB_GTI_ESCDELAY, 50 )
// hb_gtInfo( HB_GTI_FONTATTRIBUTE, 0 )
// hb_gtInfo( HB_GTI_FONTATTRIBUTE, hb_bitOr( HB_GTI_FONTA_DRAWBOX, hb_gtInfo( HB_GTI_FONTATTRIBUTE ) ) )
// hb_gtInfo( HB_GTI_FONTATTRIBUTE, hb_bitOr( HB_GTI_FONTA_CTRLCHARS, hb_gtInfo( HB_GTI_FONTATTRIBUTE ) ) )
// hb_gtInfo( HB_GTI_FONTATTRIBUTE, hb_bitOr( HB_GTI_FONTA_FIXMETRIC, hb_gtInfo( HB_GTI_FONTATTRIBUTE ) ) )
// hb_gtInfo( HB_GTI_FONTATTRIBUTE, hb_bitOr( HB_GTI_FONTA_CLRBKG, hb_gtInfo( HB_GTI_FONTATTRIBUTE ) ) )
// hb_gtInfo( HB_GTI_RESIZABLE, .F. )
// hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS )
// hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_FONT )
// hb_gtInfo( HB_GTI_MAXIMIZED, .T. )
// hb_gtInfo( HB_GTI_ISFULLSCREEN, .T. )
// hb_gtInfo( HB_GTI_ALTENTER, .T. )
hb_gtInfo( HB_GTI_CLOSABLE, .F. )
hb_gtInfo( HB_GTI_SELECTCOPY, .T. )
IF PCount() >= 4
lRawKey := !Empty( lRawKey )
ELSEIF ! Empty( cTermCP ) .AND. Upper( cTermCP ) = "X"
lRawKey := .T.
cTermCP := NIL
ELSE
lRawKey := .F.
ENDIF
IF Empty( cTermCP )
cTermCP := "UTF8"
ELSE
cTermCP := Upper( cTermCP )
ENDIF
IF Empty( cHostCP )
cHostCP := "UTF8"
ELSE
cHostCP := Upper( cHostCP )
ENDIF
lBoxChar := ! Empty( lBoxChar )
hb_cdpSelect( cHostCP )
hb_SetTermCP( cTermCP, cHostCP, lBoxChar )
#else
#ifdef _SET_EVENTMASK
Set( _SET_EVENTMASK, INKEY_ALL )
#endif
lRawKey := .f.
#endif
MDblClk( 250 )
SetCancel( .F. )
// AltD(0)
? OS(), Version(), Date(), Time()
#ifdef __HARBOUR__
? hb_gtVersion( 1 ), "GT" + hb_gtVersion()
? "Host codpage: " + hb_cdpSelect() + ", terminal codepage: " + cTermCP
#endif
? "@ - interrupt, keycodes checking: "
?
WHILE .T.
kX := Inkey( 0 )
k := hb_keyStd( kX )
IF ( i := AScan( aKeys, {| x | x[ 2 ] == k } ) ) != 0
? " key:" + Str( aKeys[ i, 2 ], 7 ) + " " + PadR( aKeys[ i, 1 ], 18 ) + aKeys[ i, 3 ]
#ifdef __HARBOUR__
IF kX != k
?? " ext: 0x" + hb_numToHex( kX, 8 ) + " -> " + ;
hb_numToHex( hb_keyMod( kX ), 2 ) + ":" + hb_numToHex( hb_keyVal( kX ), 8 ) + ;
" [" + hb_keyChar( k ) + "]"
ENDIF
#endif
ELSEIF ( k >= 32 .AND. k <= 126 ) .OR. ( k >= 160 .AND. k <= 255 ) .OR. ;
Len( hb_keyChar( k ) ) > 0
#ifdef __HARBOUR__
? "char:" + iif( k > 256, " U+" + hb_numToHex( hb_keyVal( k ), 4 ), Str( k, 7 ) ) + ;
" " + hb_keyChar( k )
IF kX != k .or. k > 256
?? " ext: 0x" + hb_numToHex( kX, 8 ) + " -> " + ;
hb_numToHex( hb_keyMod( kX ), 2 ) + ":" + hb_numToHex( hb_keyVal( kX ), 8 ) + ;
" [" + hb_keyChar( k ) + "]"
ENDIF
#else
? "char:" + Str( k, 7 ) + " " + hb_keyChar( k )
#endif
ELSE
#ifdef __HARBOUR__
? " key:" + Str( k, 7 ) + " ext: 0x" + hb_numToHex( kX, 8 ) + " -> " + ;
hb_numToHex( hb_keyMod( kX ), 2 ) + ":" + hb_numToHex( hb_keyVal( kX ), 8 ) + ;
" [" + hb_keyChar( k ) + "]"
#else
? " key:" + Str( k, 7 )
#endif
ENDIF
// ?? " (" + hb_ntos( MaxRow() ) + ":" + hb_ntos( MaxCol() ) + ")"
IF k == hb_keyCode( "@" ) .AND. NextKey() == 0
EXIT
ELSEIF k == K_INS .AND. ! lRawKey
Set( _SET_CURSOR, ( Set( _SET_CURSOR ) + 1 ) % 5 )
?? " cursor:" + hb_ntos( Set( _SET_CURSOR ) )
ELSEIF k == HB_K_RESIZE
?? " (" + hb_ntos( MaxRow() + 1 ) + "," + hb_ntos( MaxCol() + 1 ) + ")"
ELSEIF k >= 1000 .AND. k < 1100
?? " mpos(" + hb_ntos( MRow() ) + "," + hb_ntos( MCol() ) + ")"
#ifdef __HARBOUR__
ELSEIF k == K_CTRL_INS .AND. ! lRawKey
IF Alert( "Would you like to show clipboard text?", { "YES", "NO" } ) == 1
s := hb_gtInfo( HB_GTI_CLIPBOARDDATA )
? "Clipboard text: [" + s + "]"
ENDIF
ELSEIF k == K_CTRL_END .AND. ! lRawKey
IF Alert( "Would you like to set clipboard text?", { "YES", "NO" } ) == 1
s := hb_TSToStr( hb_DateTime() ) + hb_eol() + ;
"Harbour GT" + hb_gtVersion() + " clipboard test" + hb_eol()
? "New clipboard text: [" + s + "]"
hb_gtInfo( HB_GTI_CLIPBOARDDATA, s )
ENDIF
#endif
ENDIF
ENDDO
?
RETURN