Line Numbers
Alex Tweedly
alex at tweedly.net
Fri Dec 31 21:25:00 EST 2004
D.Rothe wrote:
>G'Day and Happy New Year to all!!!!!!!!
>
>I am hoping someone could guide me with the following prob.
>I have two fields (field 1 & field 2), field 2 is for loading and displaying a txt file and field 1
>is for displaying each corresponding line number of field 2.
>The line numbers must be in a seperate field otherwise they will show when printing field 2.
>
>Obviously field 2 is a scrolling field so the problem is getting field 1 to scroll in unison with field 2 so the line numbers match the correct line.
>
>Any ideas on the code or maybe a different solution!!!!
>
>
put URL "file:temp.txt" into tData
put empty into tDisplayData
put 0 into tCounter
repeat for each line L in tData
put tCounter && L & cr after tDisplayData
add 1 to tCounter
end repeat
put tDisplayData into field "Field"
It may look clumsy to scan through each line like this - but Rev is very
fast at doing that. This did my 6000 line, 1 Mb file in about 80
millisecs - so you don't need to worry about speed.
You could also do it by some variation of setting the vscroll of field
1 to the thumbpos of field 2
but I just find it easier to do it this way.
You could also do it by putting the two fields into a group and
scrolling the group (I think - haven't tried that way myself).
Happy New Year !!
-- Alex.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.298 / Virus Database: 265.6.7 - Release Date: 30/12/2004
More information about the use-livecode
mailing list