Appending characters to TextEdit ?
If I try to use the append message to send characters into a textedit object, the object adds a space (ASCII 32) between each use of the message. How do I prevent this?
Here is the test patch -
Thanks.
append allways inserts space.
If you want to output whole text without spaces
than you can use regexp or tosymbol with
separator set to remove spaces.
If you want to see on the screen text edit without spaces than maybe this:
Thanks for that. I was starting to work up something similar, but I thought maybe append worked somehow differently - like I must be using it wrong.
I find the addition of a space, and the resulting need to remove it kind of odd.
But now I know.
I'll note that the behavior of append makes it really hard to create an on-screen keyboard that can edit a TextEdit object. The example provided does resolve my original issue, but it creates a TextEdit object which effectively can't include spaces at all.
While I imagine it is possible to create a patch that can do this, it seems like it is probably more effort than it is worth. If Append didn't include spaces (that no one asked for), it would be really simple and elegant.
As usual, I'll probably have to make this happen in javascript instead.
Append (the message, not the object) is weird.
Append message is doing exactly what it should = add items.
I would not want it to remove spaces.
If you mentioned what you were after from the beginning
one could have tried something else.
try to use white space (ASCII 160) instead of space when entering
spaces that you want using that onscreen keyboard.
Thanks for the input.
FWIW, I never expected Append to "remove spaces", I just didn't want it to add them implicitly. That behavior is useful for Max's space-based lists, but not useful for String handling.
I mean, what you did there is definitely cool, but that is a silly amount of patching to achieve the goal.
It is the kind of thing someone with expertise and familiarity with Max can put together, but should it need that level of work for a relatively trivial function?
I had to use quite often too much effort for such "trivial" tasks, but max is max,
and if it can't do what you want, then learn c or java or something else.
And as cool as it is... it still adds spaces between each character in the TextEdit object.

My skills are OK. I don't claim to know every "secret handshake" Max expects. But I've built a lot of projects in Max, solved a lot of problems, and made a fair amount of income with it over the years.
I like Max for a lot of stuff, but that doesn't mean that I always accept its problem areas without comment. I'd lobby for an AppendWithoutSpaces message (or similar), otherwise the user has to perform backflips to accomplish the same thing.
String handing overall is such a weak spot in Max. It would be awesome if it were better.
Frankly, your assistance in proving my point was invaluable - I hope that's OK.
Cheers.
hm, you call it a trivial function... and maybe it is... but dont get tricked by the name "textedit"... this is a GUI object and not a standalone text program and its main purpose is displaying text beeing edited by the user, not internally. (and it is not called [stringedit] either)
technically (i.e. if it would be built-in) concatenating two strings would be done using something like sprintf or regexp, and if it would be able to perform that kind of stuff it would internally need to list its content as an array of strings, eventually number them, then perform such functions, then renumber everything...
one thing which speaks against it is that there is already the [coll] object for that kind of stuff.