Line numbers for soft-wrapped styled text?

dunbarx dunbarx at aol.com
Sat Mar 25 19:40:55 EDT 2017


Hi.

Make two small fields, both with lineWrap set to "false". Line up the two
field horizontally. Put some wrapped text into vld 1. Put this in a button
somewhere:

on mouseUp
   lock screen
   put fld 1 into storage
   replace return with return & numToChar(208) in fld 1
   put fld 1 into workingText
   put the formattedText of fld 1 into temp
   put 1 into line 1 of lineCounter
   put 1 into lineTracker
   repeat with y = 1 to the number of lines of temp
      if line y of temp contains numToChar(208) then
         add 1 to lineTracker
         put lineTracker into line y of lineCounter
      end if
   end repeat
   put storage into fld 1
   put lineCounter into fld 2
end mouseUp

I needed to pollute the source field in order to use the formattedText and
identify the hard returns.



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Line-numbers-for-soft-wrapped-styled-text-tp4713343p4713356.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list