Formatting text in an object box
Apologies if there is an easy answer to this somewhere, I can't find it.
I make objects with a lot of attributes and they always look horrible. I would really like to be able to make my object boxes look like this:
/----------------------------\
|some_object |
| |
| @attrib1 some_value |
| @attrib2 foo |
| @longer_attrib bar |
\----------------------------/
But as soon as I click out of an object box it just turns into one long ugly line. I've already seen people suggest cmd-clicking out of the box but it doesn't work for me.
1. Is there a way to do this?
2. If (as it seems) there isn't, is there any chance of getting it?
Even with option-clicking (not the command key, the option key, the one with the intergalactic "option" symbol on it) all you're doing is toggling the sense of the "Auto Fix Width" setting in the Options menu. That won't change anything about text formatting.
Max will always reduce the text inside your object to canonical form (each lexical element separated by a single blank). At the very latest this happens when you re-open a patch after it's been saved. No newlines, no tabs, no indents.
Whether or not this will change in some future update is something only Cycling 74 knows, and if they've not said anything in their Max 7 teasers (or if I've missed something), they're not telling.
So the short response is (1) no, (2) who knows?
I'd love this feature to be added as well !
Thanks Peter, you've basically confirmed what I assumed was the case.
Coming from a programming background I find it incredibly weird and frustrating that Max doesn't let you format your code. I find it very hard to clearly express the intent of my patches when the content of my object boxes is just an unreadable splurge of text.
Do you think it would be worth raising this with someone at Cycling? It doesn't seem like it should be that hard to fix.
It's always easy to say "that shouldn't be hard to fix" if you're not the one who has to do the fixing ;-)
I dunno whether it would be hard or not. From what I gather from the SDK, it looks like the "canonicization" of object box content is something that happens very early on, when an object box is created and the text is parsed (or when it's edited, which I think pretty much involves trashing the old data structure and instantiating a new object). I'm not even sure if an object box directly stores the actual text you've typed in. I think (although this might be a mistake on my part) that the object just maintains pointers to Atoms (symbols, ints, floats). Symbols are just pointers. If you deref symbols long enough, you'll get to the original text, but for the most part you can work with them without looking at what the text string is.
I suppose it would be possible to add a kind of "presentation" data structure to an object box. This could be as "no-frills" as maintaining text-only spacing or could be as funky as an Adobe Illustrator text object. Attribute names centered in blue, values boldface and right justified 2.6 cm from the right edge of the box, object names in 14.9 point Marker Felt Thin italic... you get the idea.
But Max 7 seems to be far enough along that if this isn't yet on the feature list, it's not likely to be added in this cycle.
Which shouldn't stop anyone from making a feature request.-
----
As a footnote cum afterthought: But Max does let you format your code! You can put your object boxes wherever you want them (hopefully to help clarify the logic of your data flow for the benefit of code maintenance) and you can shape the patch cords however you want. That's formatting that matters most! The content of object boxes is (relatively speaking) a pretty minor detail.
I don't want to negate your idea (which I actually like). It's just that coming from pre-attribute Max (v2.2, if anyone cares, where most objects had a name and maybe one or two arguments), I tend to see the "core" of my code as the objects and how they relate to each other. Still, now that attributes have evolved from being a Jitter-specific item to a pervasive and ubiquitous part of Max, at least a minimalist support for formatting object box content has got much to be said for it.
Sorry for the long post, funny how that happens on a long Sunday afternoon.