Useful number/flonum flag values

Oct 1, 2006 at 10:11pm

Useful number/flonum flag values

Hello all,

I decided to figure out what particular flag values number boxes recognize, as I haven’t seen a list of these anywhere (though I’m sure such lists do in fact exist). I focused on just the five flags regarding appearance, changeability, and output-on-mouse-up. Unless someone knows something I’ve missed, sending a number box a *flags* message is the only way to change these without using the Inspector (or in a locked patch). I figured it would be helpful to have outside control over number boxes, particularly with transparency, changeability, etc.

So I made a little “flag-selector” within the number Inspector. Using a decimal-to-binary converter, I was able to have each configuration (total of 32) selected, and the flag value (from the getstate message) packed into a coll. Starting with no flags, then selecting 1, then 2, but in “reverse binary” — 00000,10000,01000, etc. (I did reverse because it selects the flags from the top down, which makes more visual sense to me.) This way a *flags* value was determined for each configuration, though it’s not immediately obvious what each configuration actually represents.

The point is that several of the most common or most desired flag settings (like “Bold, Can’t Change”, or “Transparent, Output on MouseUp” or whatever you like) can be determined, then used as presets or whatever. What I don’t know is how to get the flags value from a given number (without the Inspector or in a locked patch) … however, simply being able to know and set them is helpful.

Note that the No Min and No Max flags affect each number in the list in these four ways:

0–Both “No Min” and “No Max” checked: does not change (“adds 0″)
1–”No Min” UNchecked: adds 1
2–”No Max” UNchecked: adds 2
3–Both “No Min” and “No Max” UNchecked: adds 3

… a little confusing with the double negative there …

So, starting with Bold and moving down thru the five checkboxes in binary fashion, we have:

index, flagvalue;

0, 32;
1, 36;
2, 0;
3, 4;
4, 96;
5, 100;
6, 64;
7, 68;
8, 160;
9, 164;
10, 128;
11, 132;
12, 224;
13, 228;
14, 192;
15, 196;
16, 8224;
17, 8228;
18, 8192;
19, 8196;
20, 8288;
21, 8292;
22, 8256;
23, 8260;
24, 8352;
25, 8356;
26, 8320;
27, 8324;
28, 8416;
29, 8420;
30, 8384;
31, 8388;

Here’s how they are arranged:

— 0 = no flags at all

— 1 has “Bold” checked, but nothing below that

— 2 and 3 have “Draw Triangle” checked, but nothing below that

— 4 through 7 all have “Output Only on Mouse Up” checked, but nothing below that

— 8 through 15 all have “Can’t Change” checked, but nothing below that

— 16 through 31 all have “Transparent” checked

So, for example, send the message “flags 8356” if you want a Bold, Can’t Change, Transparent number box.

Note that transparent number boxes won’t show the Triangle, though the number will offset to the right. Also note that messages sent to number boxes while the Inspector is open won’t be reflected until you close and reopen the Inspector.

So, hopefully this will be useful to some people. I know the Display Style and such, as well as the No Min/No Max could be determined and listed, too, but I wanted to limit the possible configurations to something manageable at first (32 isn’t bad…)

I know I could find lots of uses for numbers that can change their appearance and editing functions on-the-fly … being able to show and hide the number box background could be particularly handy aesthetically.

Enjoy!

–CJ

——————————————————-

p.s. Here’s the little decimal-to-binary patch, all nicely colorful and such ;)

——————————————————-

max v2;
#N vpatcher 25 70 605 570;
#P origin 0 -36;
#P window setfont “Sans Serif” 14.;
#P window linecount 1;
#P newex 396 97 107 9109518 bgcolor 40 0 40;
#B color 2;
#P button 21 46 29 2;
#P message 63 53 52 9109518 0;
#B color 2;
#N counter 0 31;
#X flags 0 0;
#P newobj 21 79 102 9109518 counter 0 31;
#B color 2;
#P window setfont “Sans Serif” 12.;
#P newex 37 352 93 9109516 prepend set;
#B color 2;
#P window setfont “Arial Black” 14.;
#P message 145 350 101 9568270 1 0 1 1 1;
#B color 2;
#P window setfont “Sans Serif” 14.;
#P message 59 264 16 9109518 1;
#B color 2;
#P message 21 264 16 9109518 0;
#B color 2;
#P newex 21 233 48 9109518 sel 0;
#B color 2;
#P toggle 21 197 26 0;
#P newex 21 155 46 9109518 & 1;
#B color 2;
#P message 133 263 16 9109518 1;
#B color 2;
#P message 95 263 16 9109518 0;
#B color 2;
#P newex 95 232 48 9109518 sel 0;
#B color 2;
#P toggle 95 196 26 0;
#P newex 95 154 46 9109518 & 2;
#B color 2;
#P message 211 264 16 9109518 1;
#B color 2;
#P message 173 264 16 9109518 0;
#B color 2;
#P newex 173 233 48 9109518 sel 0;
#B color 2;
#P toggle 173 197 26 0;
#P newex 173 155 46 9109518 & 4;
#B color 2;
#P message 287 263 16 9109518 1;
#B color 2;
#P message 249 263 16 9109518 0;
#B color 2;
#P newex 249 232 48 9109518 sel 0;
#B color 2;
#P toggle 249 196 26 0;
#P newex 249 154 46 9109518 & 8;
#B color 2;
#P message 362 263 16 9109518 1;
#B color 2;
#P message 324 263 16 9109518 0;
#B color 2;
#P newex 324 232 48 9109518 sel 0;
#B color 2;
#P toggle 324 196 26 0;
#P newex 324 154 48 9109518 & 16;
#B color 2;
#P newex 37 307 321 9109518 pack 0 0 0 0 0;
#B color 2;
#P window setfont “Sans Serif” 18.;
#P number 21 116 41 18 0 0 0 139 0 0 0 204 14 10 222 222 222 0 0 0;
#P window setfont “Sans Serif” 14.;
#P window linecount 3;
#P comment 155 34 347 9109518 This patch takes a number and turns it into binary: 5 places/digits , or 32 total combinations before the result loops (i.e. , 32-63 is the same as 0-31 , etc.);
#B frgb 91 255 228;
#P comment 42 390 414 9109518 Note: This patch is just to show the decimal-to-binary conversion. I used it in the number Inspector to do the *getstate* reporting and list packing.;
#B frgb 25 255 249;
#P connect 33 0 31 0;
#P lcolor 3;
#P connect 31 0 2 0;
#P lcolor 3;
#P connect 2 0 24 0;
#P lcolor 3;
#P connect 24 0 25 0;
#P lcolor 3;
#P connect 25 0 26 0;
#P lcolor 3;
#P connect 26 0 27 0;
#P lcolor 3;
#P connect 27 0 3 0;
#P lcolor 3;
#P connect 28 0 3 0;
#P lcolor 3;
#P connect 3 0 30 0;
#P lcolor 3;
#P connect 26 1 28 0;
#P lcolor 3;
#P connect 32 0 31 3;
#P lcolor 3;
#P connect 2 0 19 0;
#P lcolor 3;
#P connect 19 0 20 0;
#P lcolor 3;
#P connect 20 0 21 0;
#P lcolor 3;
#P connect 21 0 22 0;
#P lcolor 3;
#P connect 22 0 3 1;
#P lcolor 3;
#P connect 23 0 3 1;
#P lcolor 3;
#P connect 21 1 23 0;
#P lcolor 3;
#P connect 30 0 29 0;
#P lcolor 3;
#P connect 2 0 14 0;
#P lcolor 3;
#P connect 14 0 15 0;
#P lcolor 3;
#P connect 15 0 16 0;
#P lcolor 3;
#P connect 16 0 17 0;
#P lcolor 3;
#P connect 18 0 3 2;
#P lcolor 3;
#P connect 17 0 3 2;
#P lcolor 3;
#P connect 16 1 18 0;
#P lcolor 3;
#P connect 2 0 9 0;
#P lcolor 3;
#P connect 9 0 10 0;
#P lcolor 3;
#P connect 10 0 11 0;
#P lcolor 3;
#P connect 11 0 12 0;
#P lcolor 3;
#P connect 12 0 3 3;
#P lcolor 3;
#P connect 13 0 3 3;
#P lcolor 3;
#P connect 11 1 13 0;
#P lcolor 3;
#P connect 2 0 4 0;
#P lcolor 3;
#P connect 4 0 5 0;
#P lcolor 3;
#P connect 5 0 6 0;
#P lcolor 3;
#P connect 6 0 7 0;
#P lcolor 3;
#P connect 8 0 3 4;
#P lcolor 3;
#P connect 7 0 3 4;
#P lcolor 3;
#P connect 6 1 8 0;
#P lcolor 3;
#P pop;

#27914

You must be logged in to reply to this topic.