Forums > MaxMSP

textedit and carriage return

November 9, 2008 | 6:16 pm


I am building a patch which appends symbols to a textedit object based on the user’s interaction. In one instance, I would like the user’s interaction to produce a new line (carriage return) so that further appended symbols begin on the next line.

I am playing around with [itoa] to no avail.

November 9, 2008 | 6:43 pm

If you send 13 or 10 to [itoa] it should cause a carriage return if you append it into [textedit]. These are the ASCII values for carriage return and line feed respectively.


— Pasted Max Patch, click to expand. —
November 9, 2008 | 7:02 pm

Hey thanks!

November 9, 2008 | 7:04 pm

I’m also trying to do the same thing with a space, but it shows up in the text edit as " " (with the quotation marks).

is there any way to get rid of those?

November 9, 2008 | 7:05 pm

Nevermind, I just tried using ascii 160 instead of ascii 32 and it worked.

July 24, 2011 | 9:29 am

this asci addition works well, except it also adds a space on that newline…

July 25, 2011 | 10:19 pm

That is because using the "append" message [textedit] assumes it should add a space for the next word to follow. The best workaround I can find is seperating your first word and running it through [atoi] then prepending the newline character before converting it back to ascii. The rest of your message can be appended as normal. Here’s an example:

— Pasted Max Patch, click to expand. —
July 27, 2011 | 9:02 am

cool thankyou that works very well, except it turns an incoming value of 3dp to 6dp for some reason… its because of itoa actually.

July 27, 2011 | 9:40 am

I cannot reproduce that. It seems to work fine for me.

July 27, 2011 | 11:00 am

try this –

as output i get 3.200000 when i would expect just 3.2

— Pasted Max Patch, click to expand. —
July 27, 2011 | 8:59 pm

Try enclosing the number in "quotes" in your [message] box so it is treated as a symbol.

March 16, 2012 | 6:06 am

thank you! this helped me fix a problem I was having

October 21, 2013 | 3:17 pm

Fine! Thanx a lot….but how I can remove the first blank line??

October 22, 2013 | 12:15 am

box so it is treated as a symbol.

Fut 14 Coins

October 9, 2015 | 11:14 am

To "append" (ahem)…
This was a very useful solution to this clunky problem. However, also be sure you’ve set the attribute ‘@wordwrap 1’ for [textbox], or it won’t work and you may waste another 30 min. figuring it out. :)


Viewing 15 posts - 1 through 15 (of 15 total)

Forums > MaxMSP