Wednesday, July 04, 2007

Cut and paste on the iPhone?

Has anyone worked out how to do select, cut and paste on the iphone?

Is this a glaring omission in the User Interface or do I just not know
how to snap and move my fingers


B:ekive.blogspot.com
....Sent from my iPhone

4 comments:

  1. I've done a couple of experiments to see if you can select text using Javascript. For instance, suppose you have a textarea with id="editarea"

    You could tie to clicking a button the following
    code:
    var myField = document.getElementById("editarea");
    alert("hi there"+myField.selectionStart)
    myField.setSelectionRange(0,10);

    In my tests, the selectionStart does return a non bogus value if you have clicked somewhere within a textarea previously. So the selectionStart/selectionEnd properties of textareas work. However, unlike the non-iphone Safari, the line myField.setSelectionRange(0,10); does not highlight the first 10 characters of the textarea. Still manipulation of textareas can be done with the iPhone. So here is a way to do limited cut and pasting within a textarea. (Unfortunately, selected regions wouldn't be highlighted). Use Javascript so that when you type the letters '.@' (on the first iPhone keyboard screen) in a textarea, it searches earlier in the text area for the letters '@.' the region between these two is then cut out by manipulating the string of the textareas value. Next to ones text area one has a paste button. When one clicks this the last text that was previously cut is pasted back at the current value of selectionStart

    ReplyDelete
  2. I've done a couple of experiments to see if you can select text using Javascript. For instance, suppose you have a textarea with id="editarea"

    You could tie to clicking a button the following
    code:
    var myField = document.getElementById("editarea");
    alert("hi there"+myField.selectionStart)
    myField.setSelectionRange(0,10);

    In my tests, the selectionStart does return a non bogus value if you have clicked somewhere within a textarea previously. So the selectionStart/selectionEnd properties of textareas work. However, unlike the non-iphone Safari, the line myField.setSelectionRange(0,10); does not highlight the first 10 characters of the textarea. Still manipulation of textareas can be done with the iPhone. So here is a way to do limited cut and pasting within a textarea. (Unfortunately, selected regions wouldn't be highlighted). Use Javascript so that when you type the letters '.@' (on the first iPhone keyboard screen) in a textarea, it searches earlier in the text area for the letters '@.' the region between these two is then cut out by manipulating the string of the textareas value. Next to ones text area one has a paste button. When one clicks this the last text that was previously cut is pasted back at the current value of selectionStart

    ReplyDelete
  3. Anonymous11:21 PM

    Agreed! This is very important for those of us wishing to replace our Palms. When you have recurrent appointments at variable times cut and paste is a must!

    ReplyDelete
  4. GREAT ITEM!!! Spell Check for email. View WORD AND EXCELL DOCUMENTS WITHOUT USING THE INTERNET. TO SLOW....

    TODO LIST, A CALENDAR WITHOUT A TODO LIST???

    JAVA.....

    THANKS ALL, JUST A LITTLE WISH LIST!! GREAT PHONE!!!

    ReplyDelete