Fix Width message?

    Jun 04 2014 | 8:41 am
    Hi All,
    Is there a message I can send to comment boxes that has the same effect as fix width?
    I am changing the content of comment boxes dynamically in a patch and need them to resize relative to the content.
    Thanks, as always for your help.
    Max 6.07 Macbook Pro 13" (2010)

    • Jun 06 2014 | 4:56 pm
      Bumpity bump.
    • Jun 06 2014 | 5:10 pm
      The patching_rect attribute.
    • Jun 06 2014 | 5:32 pm
      Thanks for your response Christopher.
      Whilst your solution clearly allows for the patch-designer to fix the width of the comment box I'm seeking a way for the comment box to automatically fix width if content is updated whilst the patch is live.
      For example, imagine the user triggers an event that updates a comment box with text of significantly shorter length than its previous content,there is now excess space in the comment box.
      Here's an example of the problem for clarity:
    • Jun 06 2014 | 5:52 pm
      I thought you were asking how to change the size of an object with a message. (The matter of whether it's done by hand or by automated process is a separate issue from how to do it at all.) I thought the solution would then be implicit. I suggest to check the length of the message, and adjust the width of the object commensurately. If the messages are all known in advance, you can even store in advance all the appropriate widths associated with the messages, and look them up when the messages are chosen.
    • Jun 06 2014 | 6:04 pm
      Pre-Programming the length is an option, however, not ideal.
      What object reports the length of a symbol? It doesn't seem to be possible with [regexp], anyone have any ideas? Racking my brains (and feeling as though I'm missing the obvious)...
      Thanks Christopher,
    • Jun 07 2014 | 1:26 am
      I find that JavaScript is really handy for anything dealing with strings of characters. Download the attached super-simple .js file, save it somewhere in the Max file search path, and then try this patch.
    • Jun 07 2014 | 2:46 pm
      That's perfect Christopher! The javascript example will work once adapted. Auto-fixwidth here I come!
      Thanks so much for your input and time.
      All the best,
    • Jun 07 2014 | 3:36 pm
      After all that, though, unless you're generating messages on the fly, it seems to me to be more straightforward just to store the desired comment width along with the message, something like this.
    • Jun 07 2014 | 3:44 pm
      Whilst you are right, I will be giving my patch to a third party. A function I am building in is the ability for the user to add their own text that will appear on screen at certain times. Therefore I cannot predict the length of the text they add and also do not want to burden the user with measuring text-length themselves. I'm trying to minimise the steps they have to take when they personalise their patch.
      If it was just for my use, I would agree 100% with you and pre-programme the widths.