textedit and carriage return

Nov 9, 2008 at 6:16pm

textedit and carriage return

Hi,

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.

#40751
Nov 9, 2008 at 6:43pm

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.

lh

– Pasted Max Patch, click to expand. –
#144491
Nov 9, 2008 at 7:02pm

Hey thanks!

#144492
Nov 9, 2008 at 7:04pm

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?

#144493
Nov 9, 2008 at 7:05pm

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

#144494
Jul 24, 2011 at 9:29am

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

#144495
Jul 25, 2011 at 10:19pm

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. –
#144496
Jul 27, 2011 at 9:02am

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

#144497
Jul 27, 2011 at 9:40am

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

#144498
Jul 27, 2011 at 11:00am

try this -

as output i get 3.200000 when i would expect just 3.2

– Pasted Max Patch, click to expand. –
#144499
Jul 27, 2011 at 8:59pm

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

#144500
Mar 16, 2012 at 6:06am

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

#144501
Oct 21, 2013 at 3:17pm

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

#268679
Oct 22, 2013 at 12:15am

box so it is treated as a symbol.

______________________________________________
Fut 14 Coins

#268707

You must be logged in to reply to this topic.