Forums > MaxMSP

Number box select / deselect (?) key focus

January 15, 2007 | 3:08 am

I know you can select a number box, either by clicking or sending it the select message (nice with the tab function, using the number box’s right outlet). Is there a way to deselect a number box without clicking on the background? Like a general "keyfocus isn’t specified" message to Max?

What’s happening is I have a draggable panel that I want to snap to a grid while the "s" key is being held down. If the last object selected / edited is a number box (that is, if any number box currently has focus), the s key (and other keystsrokes for that matter) do get read, but the resulting behavior is strange — like it’s in some "no-man’s land" between being interpreted as a keystroke or going into the number box (which it doesn’t appear to). Rather tough to explain, but if there’s a message to remove keyfocus, that’s all I’m after.

–CJ


January 15, 2007 | 3:48 am

max v2;
#N vpatcher 10 59 610 459;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#N thispatcher;
#Q end;
#P newobj 190 238 61 196617 thispatcher;
#P number 63 172 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 209 107 29 196617 stop;
#P newex 209 129 67 196617 delay 10000;
#P newex 209 32 48 196617 loadbang;
#P newex 209 84 44 196617 togedge;
#P newex 209 58 66 196617 mousestate;
#P window linecount 2;
#P message 190 192 316 196617 script new selbox number -20 -20 10 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0 , script send selbox select , script delete selbox;
#P window linecount 1;
#P newex 167 130 41 196617 sel 27;
#P newex 167 96 40 196617 key;
#P connect 0 0 1 0;
#P connect 1 0 2 0;
#P connect 6 0 2 0;
#P connect 2 0 9 0;
#P connect 5 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 7 0;
#P connect 4 1 6 0;
#P connect 7 0 6 0;
#P pop;


January 15, 2007 | 3:51 am

press esc
or just wait 10"
for previous patch


January 15, 2007 | 5:21 am

That’s great — very clever! This should prove helpful.

Don’t want to be asked to save changes (creating the dummy number box changes the patch). So I attached the output of the delay to a "clean" command for thispatcher too.

–CJ

max v2;
#N vpatcher 10 59 610 459;
#P window setfont "Sans Serif" 9.;
#P newex 265 163 44 9109513 t b b;
#P message 266 239 29 9109513 clean;
#P button 310 125 15 0;
#P button 401 109 15 0;
#P message 343 113 29 9109513 stop;
#P newex 329 162 67 9109513 delay 1000;
#P newex 329 80 44 9109513 sel 0 1;
#N thispatcher;
#Q end;
#P newobj 190 238 61 9109513 thispatcher;
#P window setfont "Sans Serif" 20.;
#P number 141 86 74 20 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont "Sans Serif" 9.;
#P newex 252 35 48 9109513 loadbang;
#P newex 252 61 66 9109513 mousestate;
#P window linecount 2;
#P message 190 192 316 9109513 script new selbox number -20 -20 10 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0 , script send selbox select , script delete selbox;
#P window linecount 1;
#P newex 192 165 41 9109513 sel 27;
#P newex 192 131 40 9109513 key;
#P connect 1 0 2 0;
#P connect 13 1 2 0;
#P connect 12 0 6 0;
#P connect 2 0 6 0;
#P connect 0 0 1 0;
#P connect 4 0 3 0;
#P connect 8 0 13 0;
#P connect 13 0 12 0;
#P connect 7 0 11 0;
#P connect 3 0 7 0;
#P connect 9 0 8 0;
#P connect 7 0 8 0;
#P connect 7 1 9 0;
#P connect 7 1 10 0;
#P pop;


Viewing 4 posts - 1 through 4 (of 4 total)