listField - dontWrap

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

listField - dontWrap

Signe.Sanne
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

1. amanuensis/Senior lecturer
Romansk institutt                 Tlf. +47 55 58 21 27
?isteins gt. 1 Epost: [hidden email]
Universitetet i Bergen

http://www.hf.uib.no/mlab/Info/sms.html
_______________________________________________
use-revolution mailing list
[hidden email]
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: listField - dontWrap

masmit
If I understand the problem correctly, putting this into the script of
the field should do it.


on mouseUp
   put word 2 of the clickLine into lNum
   put the text of me into me -- resets all line to plain text
   set the textStyle of line lNum of me to underline
end mouseUp


Best,

Mark

On 13 Jun 2005, at 12:53, Signe Marie Sanne wrote:

> 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
>
> 1. amanuensis/Senior lecturer
> Romansk institutt                 Tlf. +47 55 58 21 27
> Øisteins gt. 1 Epost: [hidden email]
> Universitetet i Bergen
>
> http://www.hf.uib.no/mlab/Info/sms.html
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
_______________________________________________
use-revolution mailing list
[hidden email]
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: listField - dontWrap

Martin Baxter
In reply to this post by Signe.Sanne
>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


_______________________________________________
use-revolution mailing list
[hidden email]
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: listField - dontWrap

Signe.Sanne
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
_______________________________________________
use-revolution mailing list
[hidden email]
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: listField - dontWrap

Signe.Sanne
In reply to this post by Signe.Sanne
Signe Marie Sanne 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.

I answer myself: I found the solution. It's funny, that's the rewarding
thing about scripting, you have a problem, you try and retry, and when you
finally find the solution you really feel fine!

So here it goes:
You have two identical fields (F1 and F2), both are ordinary scrolling
fields with dontwrap set to false and listbehavior set to false.

- In field F1 you display the phrases. Copy the text of fld F1 to fld F2.
- set the layer of the copied field lower than the layer of field F1 (that
is, you put fld F2 under fld F1)
- set the textcolor of char 1 to -1 of fld F2 to white - which is the colour
of the background (in this way the text is invisible)
- move fld F2 a little to the left (0,5 cm or so)
- group the two fields. In the group script put:
            on scrollbardrag
               set the scroll of fld F2 to the scroll of fld F1
            end scrollbardrag

- in the script of fld F1 you put:
  put word 2 of the clickLine into snr
    set textcolor of char 1 to -1 of fld F2 to white (deletes the previous
bullet)
    put "???" into char 1 of line snr of fld F2 (this is the bullet
equivalent, it is not displayed correctly in this email)
    set textcolor of char 1 of line snr of fld F2 to 255,102,102

I'll upload a stack to show this within a few hours.
Signe Marie

[hidden email]   http://www.hf.uib.no/mlab/Info/sms.html
_______________________________________________
use-revolution mailing list
[hidden email]
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: listField - dontWrap

Signe.Sanne

> I'll upload a stack to show this within a few hours.
> Signe Marie

It's done. The name is BulletMarkLine. You'll find it either under
Programming, or in my userspace "sms".
Signe Marie

[hidden email]
_______________________________________________
use-revolution mailing list
[hidden email]
http://lists.runrev.com/mailman/listinfo/use-revolution