[PD] Knowing if Pd is in Edit mode when instantiating an object (was Query if Pd is in Edit mode for a GUI)

oliver oliver at klingt.org
Thu Nov 28 15:07:30 CET 2019


IOhannes m zmölnig wrote:
> Am 28. November 2019 14:18:22 MEZ schrieb Alexandre Torres Porres <porres at gmail.com>:
>>
>> Sure, but there are other ways to instantiate an object, like when
>> opening
>> a patch or with dynamic patching, where PD won't switch to edit mode.
>>
> 
> but with dynamic patching
> - you are breaking a lot of interaction expectations
> - you can control the edit-mode state at your will
> 

i.e. you can "force" edit mode with a "editmode 1" message to the 
corresponding namecanvas, and also disable it with a dedicated message

(see attached examples)

best

oliver
-------------- next part --------------
#N canvas 0 50 1061 762 10;
#X msg 40 692 restore;
#X text 23 29 objects;
#X text 411 33 GUI stuff;
#X msg 415 56 menusave;
#X msg 415 80 menusaveas;
#X msg 415 104 menuclose;
#X msg 415 216 cut;
#X msg 415 242 copy;
#X msg 415 290 duplicate;
#X msg 415 153 tidy;
#X msg 415 177 texteditor;
#X msg 415 490 editmode \$1;
#X msg 415 521 loadbang;
#X msg 415 348 menufont;
#X msg 415 432 findagain;
#X msg 415 456 findparent;
#X msg 415 266 paste;
#X msg 415 314 selectall;
#X text 22 470 reset the patch;
#X msg 40 492 clear;
#N canvas 1039 297 290 462 subpatch 0;
#X coords 0 462 1 461 50 50 0;
#X restore 413 707 pd subpatch;
#X obj 40 722 s pd-subpatch;
#X obj 415 604 s pd-subpatch;
#X msg 40 236 connect 0 0 1 0;
#X msg 40 555 read textfile.txt;
#X msg 40 579 write textfile.txt;
#X msg 415 558 vis \$1;
#X obj 560 562 loadbang;
#X msg 40 665 donecanvasdialog 1 -1 1 0 -1 1 1 50 50 100 100;
#X text 22 645 this controls graph-on-parent;
#X msg 40 260 disconnect 0 0 1 0;
#X text 178 235 obj# outlet# obj# inlet#;
#X text 117 693 ?????;
#X msg 40 173 graph mygraph;
#X obj 173 201 s pd-mygraph;
#X msg 173 173 pop \, array array1 100 float 2;
#X msg 40 73 msg 350 40 bang;
#X msg 40 97 floatatom 350 70;
#X msg 40 121 symbolatom 350 100 symbol;
#X msg 40 145 text 350 130 comment;
#X msg 40 314 editmode 1;
#X msg 40 385 key 1 8 0;
#X msg 40 361 mouseup 355 145 0;
#X text 128 385 (8 = backspace);
#X text 207 409 ?????;
#X text 181 434 ?????;
#X text 478 558 ( 0 or 1 );
#X text 522 490 ( 0 or 1 );
#X text 23 211 connections;
#X msg 40 603 scalar ds 225 225 -hi_there!;
#X text 22 531 reading/writing/creating data structures;
#X text 530 408 ( 0 or 1 );
#X text 299 5 MESSAGES TO PD:;
#X obj 396 561 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 395 494 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X obj 394 411 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 415 408 find route \$1;
#X msg 560 587 vis 0 \, clear;
#X text 49 280 events (only work when editmode = 1 \, vis = 1) !;
#X msg 415 372 font \$1 100 100;
#X msg 559 355 12;
#X msg 586 355 10;
#X text 690 19 This will create a sub patch in this window and open
it :, f 28;
#X obj 692 157 s pd-messages2pd;
#X text 812 589 You have to put the name of the patch to open and its
complete path, f 24;
#X msg 896 19 menuclose;
#X msg 723 93 vis 1 \, editmode 1 \, mouse 848 198 0 0 \, mouseup 858
208 0 \, cut \, editmode 0, f 25;
#X text 791 474 needs [path] from TOF and [split_path] from HCS, f
26;
#X text 693 440 OPEN a patch from PD;
#X msg 906 296 500 200 20 500;
#X text 690 255 relocate windows:;
#X msg 694 687 \; pd dsp \$1;
#X msg 968 686 \; pd quit;
#X obj 694 666 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 971 659 !!!!!!;
#X text 717 663 audio;
#X text 895 97 and this ugly hack will destroy it, f 20;
#X msg 691 313 \; pd-subpatch menuclose \; pd-subpatch relocate \$3x\$4+0+0
0x0+\$1+\$2 \; pd-subpatch vis 1;
#X msg 691 293 600 20 350 70;
#X text 691 265 pos_x \, pos_y size_x \, size_y \,;
#X msg 40 409 click 30 30 1;
#X msg 40 433 motion 50 50 0;
#X msg 40 337 mouse 30 30 1 0;
#X msg 40 49 obj 35 10 r test;
#X obj 696 525 cnv 14 146 15 empty empty empty 2 2 0 9 -253181 -66577
0;
#X obj 696 548 cnv 14 146 15 empty empty empty 2 2 0 9 -253181 -66577
0;
#X obj 695 500 symbol;
#X obj 695 571 pack s s, f 24;
#X obj 695 524 tof/path, f 24;
#X obj 695 547 hcs/split_path, f 24;
#X text 854 529 it's good practice to mark externals objects, f 23
;
#X text 483 103 crashes PD !;
#X text 484 176 crashes PD !;
#X obj 896 44 s pd-new_patch;
#X msg 692 63 obj 850 200 pd new_patch;
#X msg 415 129 savetofile test.pd D:/TEMP/;
#X text 589 122 1.) filename;
#X text 589 133 2.) directory;
#X msg 695 476 ol_grid.pd;
#X msg 695 596 \; pd open \$2 \$1/GUI;
#X connect 0 0 21 0;
#X connect 3 0 22 0;
#X connect 4 0 22 0;
#X connect 5 0 22 0;
#X connect 6 0 22 0;
#X connect 7 0 22 0;
#X connect 8 0 22 0;
#X connect 9 0 22 0;
#X connect 10 0 22 0;
#X connect 11 0 22 0;
#X connect 12 0 22 0;
#X connect 13 0 22 0;
#X connect 14 0 22 0;
#X connect 15 0 22 0;
#X connect 16 0 22 0;
#X connect 17 0 22 0;
#X connect 19 0 21 0;
#X connect 23 0 21 0;
#X connect 24 0 21 0;
#X connect 25 0 21 0;
#X connect 26 0 22 0;
#X connect 27 0 57 0;
#X connect 28 0 21 0;
#X connect 30 0 21 0;
#X connect 33 0 21 0;
#X connect 35 0 34 0;
#X connect 36 0 21 0;
#X connect 37 0 21 0;
#X connect 38 0 21 0;
#X connect 39 0 21 0;
#X connect 40 0 21 0;
#X connect 41 0 21 0;
#X connect 42 0 21 0;
#X connect 49 0 21 0;
#X connect 53 0 26 0;
#X connect 54 0 11 0;
#X connect 55 0 56 0;
#X connect 56 0 22 0;
#X connect 57 0 22 0;
#X connect 59 0 22 0;
#X connect 60 0 59 0;
#X connect 61 0 59 0;
#X connect 65 0 93 0;
#X connect 66 0 63 0;
#X connect 69 0 77 0;
#X connect 73 0 71 0;
#X connect 78 0 77 0;
#X connect 80 0 21 0;
#X connect 81 0 21 0;
#X connect 82 0 21 0;
#X connect 83 0 21 0;
#X connect 86 0 88 0;
#X connect 87 0 99 0;
#X connect 88 0 89 0;
#X connect 89 0 87 0;
#X connect 89 1 87 1;
#X connect 94 0 63 0;
#X connect 95 0 22 0;
#X connect 98 0 86 0;


More information about the Pd-list mailing list