Fix Width message?
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.
Nick
Max 6.07
Macbook Pro 13" (2010)
Bumpity bump.
The patching_rect attribute.
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:
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.
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,
Nick
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,
Nick
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.
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.
Cheers,
Nick