Line numbers for soft-wrapped styled text?
Alex Tweedly
alex at tweedly.net
Mon Mar 27 19:51:41 EDT 2017
What a cool idea !
In fact, could you not simply do
set the liststyle of line 1 to -1 of fld "mytextfield" to "decimal"
and then unset the liststyle whenever needed (e.g. when the field is
subject to copy, save, etc.)
-- Alex.
On 27/03/2017 20:32, Richard Gaskin via use-livecode wrote:
>
>
> This morning Jim Lambert emailed me a very different solution that I
> thought would be worth sharing here.
>
> Here he uses the engine's own metrics for calculating vertical line
> spacings, by having the number field placed below the editable text
> field, setting its width to that of the editable field + a left margin
> in which he uses the engine's support for numeric list styles to draw
> the line numbers:
>
> on textchanged
> lock screen
> set the htmltext of fld "nums" to the htmltext of me
> set the liststyle of line 1 to -1 of fld nums to "decimal"
> set the scroll of fld "nums" to the scroll of me
> end textchanged
>
> The only downside I can see to this approach is for memory, as it
> requires copying the full styled text from the source field into the
> line number field.
>
> Very minor drawbacks for my needs are aesthetic: I prefer a line
> number field without trailing decimal points ("1" rather than "1." as
> LC's listStyle renders), and that line number be left-aligned by LC
> renders its list line numbers left-aligned.
>
> But overall quite nice, and very snappy. Thanks, Jim!
>
More information about the use-livecode
mailing list