aboutsummaryrefslogtreecommitdiff
path: root/doc/pddp/keyname-help.pd
blob: 04a9b8093a26ff8e4a4ec8e2351d223d1c562e49 (plain)
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
#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 keyname 3 12 0 18
-204280 -1 0;
#X obj 0 338 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 15 12 0 13
-228856 -1 0;
#N canvas 51 244 494 344 META 0;
#X text 12 105 PLATFORM windows macosx gnulinux;
#X text 12 165 LIBRARY internal;
#X text 12 205 WEBSITE http://crca.ucsd.edu/~msp/;
#X text 12 245 RELEASE_VERSION 0.41.4;
#X text 12 225 RELEASE_DATE 2009-06-12;
#X text 12 65 LICENSE SIBSD;
#X text 12 185 AUTHOR Miller Puckette;
#X text 12 265 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 and key name from the keyboard
;
#X text 12 25 NAME keyname;
#X text 12 125 OUTLET_0 float;
#X text 12 145 OUTLET_1 symbol;
#X text 12 45 KEYWORDS control symbol_op user_input;
#X restore 500 597 pd META;
#X obj 0 365 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 15 12 0
13 -228856 -1 0;
#X obj 0 437 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 15 12
0 13 -228856 -1 0;
#X obj 0 464 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 15
12 0 13 -228856 -1 0;
#X text 98 441 (none);
#N canvas 104 445 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 text 20 73 Externals and other object libraries;
#X text 19 100 [gemkeyboard];
#X text 102 100 [gemkeyname];
#X obj 22 43 key;
#X text 8 2 [keyup] Related Objects;
#X obj 53 43 keyup;
#X restore 102 597 pd Related_objects;
#X text 98 373 float;
#X obj 78 374 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
-162280 0;
#X text 98 342 (none);
#X obj 103 221 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#N canvas 103 159 428 356 reacting_to_user_input 0;
#X text 20 38 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 20 104 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 34 241 onKeyUp;
#X text 34 222 onKeyDown;
#X text 34 260 onKeyPress;
#X text 21 291 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 21 170 It's interesting to note that with these tools \, PD
can mimic some of the functions in other languages - Javascript for
example has:;
#X text 8 2 [keyup] Reacing to User Input;
#X restore 102 523 pd reacting_to_user_input;
#X obj 472 3 keyname;
#X obj 445 20 pddp/pddplink http://wiki.puredata.info/en/keyname -text
pdpedia: keyname;
#X obj 103 167 keyname;
#X symbolatom 142 195 10 0 0 0 - - -;
#X floatatom 103 195 5 0 0 0 - - -;
#X obj 142 221 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 155 167 When you type on the keyboard \, [keyname] sends data
to Pd;
#X text 100 115 [keyname] reports the (system dependent) names of "printing"
keys of the keyboard. It captures both the "keydown" and "keyup" events.
;
#X text 168 373 - the left inlet produces a 1 when a key goes down
\, and a zero when the key goes up.;
#X obj 78 404 cnv 17 3 17 empty \$0-pddp.cnv.let.1 1 5 9 0 16 -228856
-162280 0;
#X text 98 403 symbol;
#X text 168 403 - the right outlet produces a symbol which represents
the name of the key.;
#X text 99 467 Caveat - this object 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.;
#X obj 275 572 pddp/pddplink all_about_hid.pd -text all_about_hid;
#X text 100 573 for more on HIDs:;
#N canvas 107 131 327 410 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 218 30 r keyboard_fun;
#X msg 52 105 read keyboard_fun.txt;
#X msg 45 51 rewind;
#X obj 218 112 symbol add2;
#X obj 218 83 t b s;
#X obj 218 138 pack s s;
#X obj 218 164 route list;
#X msg 47 245 set;
#X msg 47 278;
#X obj 218 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 549 pd some_keyboard_fun;
#X text 11 23 get input and key name from the keyboard;
#X text 168 342 - [keyname] gets input directly from the keyboard.
;
#X obj 4 597 pddp/pddplink pddp/help.pd -text help;
#X connect 16 0 18 0;
#X connect 16 1 17 0;
#X connect 17 0 19 0;
#X connect 18 0 12 0;