Useful number/flonum flag values

    Oct 01 2006 | 10:11 pm
    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.
    p.s. Here’s the little decimal-to-binary patch, all nicely colorful and such ;)
    max v2;