listField - dontWrap

Martin Baxter martin at materiaprima.fsnet.co.uk
Mon Jun 13 08:31:46 EDT 2005


>Hello,
>I have a number of phrases, each delimited by return in a scrolling field.
>When the user clicks anyone of these, the line should be highlighted in some
>way.
>
>The problem is that some of the phrases are longer than the field width, if
>I use list field behaviour the longest phrases are just cut off. I searched
>the archives and found two scripts for "formatFld", but none of them worked
>for me.
>
>I then tried to calculate the distance from the top of the field and placed
>a gray graphic underneath, but this solution will not work when the user
>scrolls the field. Grateful for suggestions.
>--
>Signe Marie Sanne
>

Hi,

There may be a prettier way to do this but you can have a scrolling field
with:
lock text true, dontwrap false, listbehaviour and autohilite off, and give
it a script like:

on mouseup
  put word 2 of the clickline into lnum
  put the number of lines in me into ltot
  set the backgroundcolor of line 1 to ltot of me to empty
  set the backgroundcolor of line lnum of me to the hilitecolor
end mouseup

# Which puts a coloured background behind the text of the clicked line. And
is at least close to what I think you want.

Martin Baxter




More information about the use-livecode mailing list