Subject: How to allow user to select text from screen?

Original Post Kenn Nesbitt's Avatar

Kenn Nesbitt

05 Feb, 2010 08:44 PM via web

I'm developing an iPhone database app in which the user enters a search term in a search bar, and the app displays results in the HTML area of the screen (setting document.getElementById('message').innerHTML).

The trouble is, I would like the user to be able to select a portion of the results to copy to the clipboard, but the display doesn't respond when I double-click it or click and hold.

Is there a way to make the HTML display user-selectable? Seems like this should be straightforward, but I've been googling for a while and making no headway.

  1. 2 Posted by Robb Shecter on 06 Feb, 2010 01:38 AM

    Robb Shecter's Avatar

    Works for me using exactly the method you describe.

  2. 3 Posted by Kenn Nesbitt on 08 Feb, 2010 10:30 PM

    Kenn Nesbitt's Avatar

    That's odd. I haven't tried it on an actual device yet, but on the simulator, any HTML that is displayed is definitely not selectable.

    For example, if I run the Kitchen Sink app, click the UI button, and select Text Fields from the list, the Kitchen Sink app displays a number of text fields and some plain text. Anything in the text fields can be selected, copied, pasted, etc. But any of the text displayed on the screen outside of the text fields can not be selected.

    I'm using Snow Leopard, iPhone SDK 3.1.2, and the latest Titanium.

    Is there some setting I need to change somewhere?

  3. 4 Posted by Robb Shecter on 09 Feb, 2010 02:46 AM

    Robb Shecter's Avatar

    Hmm. I did notice that on the device, it seems only partially selectable. E.g., in certain situations I can only select one word at a time.

  4. 5 Posted by Kenn Nesbitt on 12 Feb, 2010 06:16 AM

    Kenn Nesbitt's Avatar

    I've got my app running on a device now, and I find that I can select a single word on the device. If I'm careful, I can also drag the selection to expand it. Also, although it gives me the Copy option, it does not give me a Select All option.

    In the simulator, I still can't select any text.

    In other words, although it works, it doesn't work as well as I expect it should, though I'm not sure why.

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

You can attach files up to 10MB

What is the opposite of north?

Recent Discussions

13 Mar, 2010 01:38 PM
13 Mar, 2010 12:39 PM
13 Mar, 2010 11:06 AM
13 Mar, 2010 10:58 AM
13 Mar, 2010 09:02 AM