Forums > MaxMSP

num VS key

January 6, 2008 | 10:51 am

Hello,

I’d be happy to drag my [numbox] to choose a value, then to select some function by pressing a [key].
Unfortunately, I can’t do this second action because the numbox stays "lighted" and waits for a new entry.
Is there a way to avoid this ?

max v2;
#N vpatcher 10 59 490 316;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 86 35 192 196617 drag number then press "1" : impossible;
#P button 285 151 15 0;
#P button 87 140 15 0;
#P number 87 76 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 264 151 15 0;
#P newex 264 120 53 196617 sel 49 50;
#P number 264 96 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 264 71 40 196617 key;
#P comment 240 124 24 196617 "1";
#P comment 103 142 77 196617 to any function;
#P connect 6 0 7 0;
#P connect 2 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 5 0;
#P connect 4 1 8 0;
#P pop;


January 6, 2008 | 11:15 am

i had the same problem
this will deselect after 10 seconds
eliminate the delay if you don’t want the typing option on the numbox

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 143 186 29 196617 stop;
#P newex 143 208 67 196617 delay 10000;
#P newex 143 111 48 196617 loadbang;
#P newex 143 163 44 196617 togedge;
#P newex 143 137 66 196617 mousestate;
#P window linecount 2;
#P message 143 236 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 connect 1 0 2 0;
#P connect 4 0 0 0;
#P connect 2 0 5 0;
#P connect 2 1 4 0;
#P connect 5 0 4 0;
#P connect 3 0 1 0;
#P window clipboard copycount 6;


January 6, 2008 | 5:36 pm

At 3:51 AM -0700 1/6/08, Derrick Giscloux wrote:
>I’d be happy to drag my [numbox] to choose a value, then to select some function by pressing a [key].

As long as you’re willing to hit the Tab key after dragging your number, this sort of does what you want, I think.

#P window setfont "Sans Serif" 9.;
#P window linecount 4;
#P comment 343 95 217 196617 The idea is that , while you can’t de-select numbers directly , you can select other things. In this case we select a textedit object which passes on subsequent key-presses.;
#P number 91 189 35 9 0 0 160 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 117 66 63 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 37 65 63 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 103 166 40 196617 key;
#P message 90 130 37 196617 select;
#P comment 127 190 203 196617 keypresses when numbers aren’t focussed.;
#P user textedit 90 147 103 157 32896 3 9 asd;
#P noclick;
#P comment 104 146 176 196617 < - textedit object needs to be visible;
#P comment 183 66 204 196617 < - some numbers in your UI. Tab deselects.;
#P connect 5 0 8 0;
#P connect 2 1 8 0;
#P connect 6 1 4 0;
#P connect 7 1 4 0;
#P connect 4 0 2 0;
#P window clipboard copycount 10;

-C


Chris Muir | "There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue." – Brian Eno


January 6, 2008 | 8:00 pm

Another alternative: ice.key happily ignore the state of the number box and will report keystrokes whether or not your numbox is selected.

It’s part of iCE Tools and, as such, commercial.


January 6, 2008 | 9:01 pm

On 6 janv. 08, at 11:51, Derrick Giscloux wrote:
> I’d be happy to drag my [numbox] to choose a value, then to select
> some function by pressing a [key].
> Unfortunately, I can’t do this second action because the numbox
> stays "lighted" and waits for a new entry.
> Is there a way to avoid this ?

You could use rs.numbox instead of the stock numbox object as it does
not get keyboard focus.
Of course, still Mac only.

Roby


January 7, 2008 | 6:52 am

Thanks to all.

So … Max 5 request ?
-> numbox with locked "drag entry" flag .

thank you !


January 7, 2008 | 10:42 pm

That’s why I don’t use number keys as key-triggers for stuff, as tempting as it is (like a # = channel number or something). So when you’re in a number box, you can still type any other key besides numbers, hyphen, period, Tab, or Enter and they will still get recognized (right?) and be usable as triggers. Popping open subpatches via pcontrol is my favorite use of key triggers, since you can control a lot of stuff while not using a mouse, or while seeing a full-screen visualization.

Using the TAB to go through a bunch of number boxes (via select as shown on this thread) is nice too: for example, if you use "f" to pop open a subpatch with a set of frequencies, you could also have it select the first box automatically. So you could hit "f", then type a frequency, then tab through the others and change them too, all without ever seeing the patch, if space is an issue or there are more interesting things to look at ;)

–CJ


January 10, 2008 | 3:05 pm

Here’s the soluce for my problem.
It is in fact fair simple.

max v2;
#N vpatcher 20 74 421 456;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 185 129 40 196617 key;
#P number 220 238 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 184 192 46 196617 t clear i;
#P newex 185 168 44 196617 numkey;
#P user panel 111 72 201 241;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X shadow 0;
#X done;
#P fasten 1 1 2 0 224 188 189 188;
#P connect 4 0 1 0;
#P fasten 2 0 1 0 189 216 177 216 177 157 190 157;
#P connect 2 1 3 0;
#P pop;


January 10, 2008 | 3:25 pm

I don’t understand why there is a "select" message for numbox BUT NO "unselect" or "deselect" message !!
Sorry, but it is a lacuna.


January 10, 2008 | 7:49 pm

The asymmetrical focus situation with numbox probably seems strange, but it’s one of those things that happens when systems evolve over two decades. It’s a legacy thing.

Originally the only way to select/deselect a numbox was with the mouse. E basta. With Max 4, which introduced Inspectors (written as patches) to replace standard Mac Dialog Boxes (which was how options in UI objects were set prior to Max 4), numboxes started being used as something like dialog entry fields, and some programmatical way of changing focus was needed. In that context, the select message did an adequate job.

I actually agree with you, but I think at the time select was added to numbox, a more general solution just wasn’t going to happen. Although I’d sort of hoped for something in one of the 4.x releases, maybe with 5.0 we’ll get a blur message.

– P.


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