Hi.

That works for "simple" fields which may contain soft-wrapped lines - but it doesn't account for styled text (e.g. where different lines may be different font sizes (or even mixed sizes), or where paragraph spacing has been set, or .... all the complex kinds of text we can now do.

but for situations where those complexities can be avoided, it is much simpler and faster :-)

-- Alex.


On 25/03/2017 23:40, dunbarx via use-livecode wrote:
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.

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to