Page 1 of 1

Help with selecting text in a field

Posted: Tue May 15, 2012 12:53 am
by petero
In a normal list field, you can select a line of text and identify the line selected.

I wish to do the same thing under slightly different circumstances.

The field will be on an iPhone. The field width is not wide enough to display what is contained in a line, so I turned off list behavior and dontwrap.

Now, however, I would like to be able to click (touch) that first entry (which because it wrapped around, may cover two to three lines) and have the result of that touch do something.

I have placed a blank line as a separator after each entry that completes the text that is in "one line" but wraps around.

For example, the data in the field might look like this: (the data was entered on one line, not several, when displayed with dontwrap, it wraps.)

This is the first line of
information that I would like
to select.

This is the second line of inform-
ation that I would like to select


Any ideas? (It seems that with list behavior on, i cannot turn off dontwrap.)

Thanks in advance for your suggestions. They are really appreciated.

Peter

Re: Help with selecting text in a field

Posted: Tue May 15, 2012 2:48 am
by shaosean
Best bet would to be look at using the DataGrid

Re: Help with selecting text in a field

Posted: Tue May 15, 2012 6:44 pm
by petero
If I use a data grid, is it possible to have a one column grid?

Can the data in that one column wrap around in the cell?

Is the cell than selectable?

Thank you.

Peter

Re: Help with selecting text in a field

Posted: Tue May 15, 2012 8:14 pm
by Klaus
Hi Peter,

why not just try it yourself?
What could happen besides the fact that your computer will explode? :D

This page might help a bit:
http://lessons.runrev.com/m/datagrid
And of course ask here, if you get stuck!


Best

Klaus

Re: Help with selecting text in a field

Posted: Wed May 16, 2012 2:37 am
by petero
I did try it (before your suggestion) but could not get the contents of a data grid cell to wrap around.

I am trying to think of some creative coding that would let me select the wrapped text in my one column scrolling list field.

Thanks for the suggestion anyway.

peter

Re: Help with selecting text in a field

Posted: Wed May 16, 2012 9:18 am
by shaosean
This is the lesson you need to look at..
http://lessons.runrev.com/s/lessons/m/d ... ne-heights

This is the code you need to add

Code: Select all

    put item 2 of theFieldRect \
           + the formattedHeight of field "Label" of me \
           - the bottomMargin of field "Label" of me \
           into item 4 of theFieldRect
    set the rect of field "Label" of me to theFieldRect
    put item 4 of theFieldRect into item 4 of pControlRect