[textedit]: seeking help with deleting the last "append"


    Jan 27 2013 | 6:25 pm
    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
    [attachment=213409,4957]

    • Jan 28 2013 | 11:23 am
      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?
    • Jan 29 2013 | 1:09 am
      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)
    • Jan 30 2013 | 2:06 am
      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.
    • Jan 30 2013 | 9:50 am
      Wetterberg, this is quite an elegant solution.
    • Jan 30 2013 | 3:54 pm
      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.
    • Jan 30 2013 | 4:55 pm
      a variation using regexp
    • Jan 30 2013 | 5:27 pm
      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.
    • Jan 30 2013 | 8:01 pm
      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.
    • Jan 30 2013 | 11:32 pm
      thank you!
    • Jan 31 2013 | 3:43 am
      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.