listField - dontWrap

Signe Marie Sanne Signe.Sanne at roman.uib.no
Mon Jun 13 09:09:54 EDT 2005


Martin Baxter skrev:

>>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

Thanks to both Mark and Martin for possible solutions to my problem. I must 
admit that the possibility of setting the backgroundcolor of lines in a 
field was new to me!

However, I had not explained enough about the field. It serves to show the 
phrases with all occurrences of one word. I have already coloured this one 
word and was looking for a way to focus the line the user clicks. Martin's 
solution would have been ideal to me but for one reason: The letter v is 
displayed as superscript and the background colour of all the v's on the 
clicked line is as well treated as superscript, ie. lifted a few millimeters 
above the line. So what I am looking for is either how to put a graphic 
underneath the line, or a bullet to the left of the field to mark the line, 
the way it is done in the script editor window.

Signe Marie


More information about the use-livecode mailing list