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
|
#N canvas 0 0 555 619 10;
#X obj 0 595 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0
14 -228856 -66577 0;
#X obj 0 0 cnv 15 552 40 empty \$0-pddp.cnv.header key 3 12 0 18 -204280
-1 0;
#X obj 0 257 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13
-228856 -1 0;
#N canvas 51 242 494 344 META 0;
#X text 12 105 PLATFORM windows macosx gnulinux;
#X text 12 145 LIBRARY internal;
#X text 12 185 WEBSITE http://crca.ucsd.edu/~msp/;
#X text 12 65 LICENSE SIBSD;
#X text 12 165 AUTHOR Miller Puckette;
#X text 12 245 HELP_PATCH_AUTHORS Dave Sabine \, July 11 \, 2003 Jonathan
Wilkes revised the patch to conform to the PDDP template for Pd version
0.42.;
#X text 12 5 GENRE help;
#X text 12 85 DESCRIPTION get input from the keyboard;
#X text 12 25 NAME key;
#X text 12 125 OUTLET_0 float;
#X text 12 45 KEYWORDS control user_input;
#X text 12 225 RELEASE_VERSION;
#X text 12 205 RELEASE_DATE 1997;
#X restore 500 597 pd META;
#X obj 0 285 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0
13 -228856 -1 0;
#X obj 0 445 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12
0 13 -228856 -1 0;
#X obj 0 473 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12
0 13 -228856 -1 0;
#X text 98 449 (none);
#N canvas 92 446 428 145 Related_objects 0;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -204280 -1 0;
#X obj 21 42 keyup;
#X obj 61 42 keyname;
#X text 19 72 Externals and other object libraries;
#X text 7 1 [key] Related Objects;
#X obj 18 94 pddp/helplink Gem/gemkeyboard;
#X obj 18 114 pddp/helplink Gem/gemkeyname;
#X restore 102 598 pd Related_objects;
#X text 98 293 float;
#X obj 78 294 cnv 17 3 140 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
-162280 0;
#X obj 489 3 key;
#X obj 465 20 pddp/pddplink http://wiki.puredata.info/en/key -text
pdpedia: key;
#X text 98 261 (none);
#X text 98 411 Also note that key combinations \, such as SHIFT+7 produce
a different result than SHIFT or 7 alone.;
#X text 168 346 Some keys \, such as SHIFT or the F1-F12 series all
produce a zero \, but we can see by the [bng] that the event is not
ignored completely...but the numeric "ID" of the key is not captured
successfully. (This may produce different results on different systems.)
;
#X text 168 293 - the number received at the outlet represents the
numeric "ID" of a key on the computer's keyboard. This event occurs
when the key is pressed down. Only one event is captured at a time.
;
#X obj 103 137 key;
#X obj 83 174 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X floatatom 103 174 5 0 0 0 - - -;
#X text 132 137 Type something on the keyboard to send input to Pd
;
#X text 100 95 [key] reports the (system dependent) numbers of "printing"
keys of the keyboard.;
#X text 99 477 Caveat - this only works if Pd actually gets the key
events which can depend on the stacking order of windows and/or the
pointer location. This is dependent on the system.;
#N canvas 105 161 428 356 reacting_to_user_input 0;
#X text 19 37 Most \, if not all \, programming environments provide
us with tools to capture 'user initiated' events from the operating
system. Keyboard input \, mouse clicks \, and mouse movements are the
most common events in this 'user event' category.;
#X text 19 103 Pd's [key] \, [keyup] \, and [keyname] are complimented
by the externals such as [gemmouse] and [nimouse] to provide us with
a full range of tools to gleen a user's activities at the computer.
;
#X text 33 240 onKeyUp;
#X text 33 221 onKeyDown;
#X text 33 259 onKeyPress;
#X text 20 290 hmmm...wouldn't it be great if Pd also gave us onChange
\, onBlur \, onFocus \, onClick \, onDblClick \, onDragDrop \, onLoad
\, onMouseDown \, onMouseOver \, onMouseOut \, onMouseMove \, onUnload...?
;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -204280 -1 0;
#X text 7 1 [key] Reacing to User Input;
#X text 20 169 It's interesting to note that with these tools \, PD
can mimic some of the functions in other languages - Javascript for
example has:;
#X restore 102 524 pd reacting_to_user_input;
#N canvas 105 31 345 511 some_keyboard_fun 0;
#X obj 52 75 loadbang;
#X msg 23 16 bang;
#X obj 33 158 qlist;
#X floatatom 33 185 5 0 0 0 - - -;
#X obj 228 30 r keyboard_fun;
#X msg 52 105 read keyboard_fun.txt;
#X msg 45 51 rewind;
#X obj 228 112 symbol add2;
#X obj 228 83 t b s;
#X obj 228 138 pack s s;
#X obj 228 164 route list;
#X msg 47 245 set;
#X msg 47 278;
#X obj 228 57 symbol;
#X text 71 17 Click here to start...;
#X msg 62 131 tempo 0.8;
#X obj 47 217 loadbang;
#X connect 0 0 5 0;
#X connect 0 0 15 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X connect 4 0 13 0;
#X connect 5 0 2 0;
#X connect 6 0 2 0;
#X connect 7 0 9 0;
#X connect 8 0 7 0;
#X connect 8 1 9 1;
#X connect 9 0 10 0;
#X connect 10 0 12 0;
#X connect 11 0 12 0;
#X connect 13 0 8 0;
#X connect 15 0 2 0;
#X connect 16 0 11 0;
#X restore 102 548 pd some_keyboard_fun;
#X obj 245 571 pddp/pddplink all_about_hid.pd -text all_about_hid;
#X text 100 572 for more on HIDs:;
#X text 11 23 get input from the keyboard;
#X text 168 261 - [key] gets input directly from the keyboard.;
#X obj 4 597 pddp/pddplink pddp/help.pd -text help;
#X connect 17 0 18 0;
#X connect 17 0 19 0;
|