[textedit]: seeking help with deleting the last "append"
A brief intro: I'm trying to develop a keyboard on my iPad through touchOSC (see attached photo). So the user can type on the ipad and see what they're typing being updated in real time.
One thing i am struggling with is figuring a way to delete the last appended letter (and perhaps even a stored history, so you can delete more than the last one).
Any tips or tricks is greatly appreciated. Also any organization/patching tips for my currently bulky patch is appreciated as well.
Thanks
Next time just "copy compressed" and paste the patcher.
Also, i have no idea what is the problem. Any possibility you could upload the TouchOSC layout as well, I don't know what kind of messages you get into the osc-route?
I'm not sure you need the touchosc layout to figure out how to delete single characters from a [textedit], but i'll attach it anyways.
The method is probably using [coll] and just storing every additional letter entered as a separate entry, and then just having a delete button that scrolls back through the entries, but i suppose i am looking for a more simple method, if one exists.
Anyways thanks for the reply and help. I'll also paste a "copy compressed" version as well (never knew that existed)
This is as simple as I could do it - I don't have mad regexp chops, so it could probably be boiled down to a long annoying command set, but this works.
Wetterberg, this is quite an elegant solution.
thanks ploki - I thought so too, hehe. I do love a little max puzzle - sometimes I wonder if that's all I do with it, really.
a variation using regexp
hehe, awesome. Emmanuel, could you please break down what goes on in the expression? I've often found it frustrating to learn regexp properly with external resources.
Sure.
So in (.+)..
means any character+
is a quantifier which defines how many times the thing before (.
) appears (from 1 to many, but it's greedy so it will try to catch as much character as possible)( )
backreference, it remembers the thing between parenthesis
so basically you memorize everything in the string but the last character. And you substitute by the content of the first %1
backreference.
thank you!
Yes! Thanks Wetterberg and Emmanuel for these two designs (and nicolas for that link). [zl ecils] is a pretty useful object that I should have known to use, but regexp is something i definitely need to explore more. it does feel great to solve these max logic puzzle-problems.