#N struct template9 float x float y float w float h float q;
#N canvas 182 49 664 749 12;
#X floatatom 295 523 4 0 0 0 - - - 0;
#N canvas 852 53 388 446 data9 1;
#X scalar template9 19 186 73 25 9 \;;
#X scalar template9 293 328 38 32 66 \;;
#X scalar template9 202 32 46 71 78 \;;
#X scalar template9 42 300 55 81 207 \;;
#X scalar template9 140 183 28 72 634 \;;
#X scalar template9 250 125 46 11 48 \;;
#X scalar template9 26 62 70 11 903 \;;
#X scalar template9 275 36 49 23 152 \;;
#X scalar template9 230 175 25 27 710 \;;
#X scalar template9 311 254 50 25 612 \;;
#X scalar template9 19 114 77 26 16 \;;
#X scalar template9 177 241 39 66 866 \;;
#X scalar template9 44 239 27 27 125 \;;
#X scalar template9 117 111 66 32 319 \;;
#X scalar template9 135 61 50 25 454 \;;
#X scalar template9 316 143 21 45 583 \;;
#X scalar template9 270 230 25 38 548 \;;
#X scalar template9 237 278 24 73 214 \;;
#X scalar template9 143 332 49 77 649 \;;
#X scalar template9 288 91 72 19 325 \;;
#X coords 0 446 1 445 0 0 0;
#X restore 524 484 pd data9;
#N canvas 407 339 705 419 template9 0;
#X obj 171 124 struct template9 float x float y float w float h float q;
#X obj 171 268 outlet;
#X obj 182 159 print struct-template9;
#X text 347 158 <-- print all messages.;
#X text 42 17 [struct] outputs messages notifying you when objects of this structure are interacted with. In run mode you get: 'click' (when you click on them) and 'change' (when you change field values by dragging). In edit mode you get: 'select' when you select the object \, 'deselect' when you deselect it and 'displace' when you move it around. Here we catch 'change' and 'select' interactions and pass the pointer through with the [route] object., f 86;
#X obj 171 199 route select change displace;
#X obj 299 229 unpack p;
#X text 153 316 Note: later we'll see how to deal with arrays in data structures. Unfortunately \, at least until now \, you can't have messages like 'change' when clicking and dragging an array element value., f 65;
#X obj 394 234 drawnumber q 0 0 0;
#X obj 393 207 filledpolygon -d q 0 1 0 0 w 0 w h 0 h;
#X connect 0 0 2 0;
#X connect 0 0 5 0;
#X connect 5 0 1 0;
#X connect 5 1 1 0;
#X connect 5 2 6 0;
#X connect 6 0 1 0;
#X restore 295 440 pd template9;
#X obj 295 495 get template9 x y w h q;
#X floatatom 413 523 4 0 0 0 - - - 0;
#X floatatom 374 523 4 0 0 0 - - - 0;
#X floatatom 334 523 4 0 0 0 - - - 0;
#X floatatom 453 523 4 0 0 0 - - - 0;
#X msg 295 703 \; set-x set \$1;
#X msg 334 665 \; set-y set \$1;
#X msg 374 627 \; set-w set \$1;
#X msg 413 588 \; set-h set \$1;
#X msg 453 549 \; set-q set \$1;
#X floatatom 95 445 5 0 0 0 - set-x - 0;
#X obj 95 482 set template9 x;
#X obj 95 540 set template9 y;
#X obj 95 598 set template9 w;
#X obj 95 655 set template9 h;
#X obj 95 712 set template9 q;
#X floatatom 95 516 5 0 0 0 - set-y - 0;
#X floatatom 95 574 5 0 0 0 - set-w - 0;
#X floatatom 95 632 5 0 0 0 - set-h - 0;
#X floatatom 95 689 5 0 0 0 - set-q - 0;
#X text 391 440 <-- open for details;
#X text 44 12 The [struct] object outputs a pointer in different interaction situations with scalars \, such as clicking on it \, changing a field value \, selecting it and displacing it. This patch demonstrates catching some of these interactions with the [filledpolygon] and [drawnumber] objects., f 79;
#X text 44 203 The [get] object receives the pointer and outputs the values of all requested fields. In this case we get all the 5 parameters from the [struct]. You can also set the number boxes connected to the [set] objects so you're able to change them., f 79;
#X text 44 72 When in run mode (that is not in edit mode) you can resize the [fillepolygon] object by clicking on any corner of the rectangles besides the bottom left one. You can see when you can do it when the arrow points upwards \, showing you can resize it. The top left corner resizes vertically \, the bottom right resizes horizontally \, and the top right resizes both vertically and horizontally. When doing so \, you can see in the Pd window that [struct] sent a "click" message and "change" messages to reflect changing the values of 'w' (width) and 'h' (height) fields. You can also click on the number and change its value \, which sets the 'q' (color) field and see the same messages being printed., f 79;
#X text 44 264 If you go into edit mode in the [pd data9] window \, you can also select a scalar (note the blue "selection" rectangle). When you deselect \, [struct] also outputs a "deselect" message. The [filledpolygon] object is created with the '-d' flag \, which means you can click on it and displace it \, in which case you'll also see the "displace" message sent by [struct]. Without this flag \, you can only displace it in the edit mode after you select it., f 79;
#X text 44 353 The click message outputs 5 parameters \, the 2 first ones are the click position within the object. The remaining 3 report modifications. The first one outputs "1" if you click pressing "shift" \, the second one resports "1" for "alt" and the third one reports "1" for double clicking., f 79;
#X connect 0 0 8 0;
#X connect 2 0 3 0;
#X connect 2 0 14 1;
#X connect 2 0 18 1;
#X connect 2 0 17 1;
#X connect 2 0 16 1;
#X connect 2 0 15 1;
#X connect 3 0 0 0;
#X connect 3 1 6 0;
#X connect 3 2 5 0;
#X connect 3 3 4 0;
#X connect 3 4 7 0;
#X connect 4 0 11 0;
#X connect 5 0 10 0;
#X connect 6 0 9 0;
#X connect 7 0 12 0;
#X connect 13 0 14 0;
#X connect 19 0 15 0;
#X connect 20 0 16 0;
#X connect 21 0 17 0;
#X connect 22 0 18 0;
