How to create a hyperlink within a text field?

Kay C Lan lan.kc.macmail at gmail.com
Wed Feb 3 21:20:19 EST 2016


On Thu, Feb 4, 2016 at 12:58 AM, Peter Brigham <pmbrig at gmail.com> wrote:

> Two ways to do it. The first and simplest is to lock the screen and do 2
> finds in succession, as you suggested.


It's not that simple. If your chapter is called 'Opinions' or 'LiveCode' or
something else that may frequently appear in your text you can not
guarantee it will be the 2nd find.

The second is to get the lineoffsets
> of the link text and scroll to the second occurrence of it.


With lineOffset you can guarantee that it will be the first line found by
determining how long your TOC is or on what line the 'body' of your
information starts within your field and using this as the <linesToSkip>
parameter.

select line (lineOffset(tHeading, fld "Interesting stuf", 27) + 3) of fld
"interesting stuff"

Once you find
> the line offset of the actual chapter heading, use "the formattedheight of
> line 1 to chapterLineNbr of fld xxx" to get the scroll, and then set it
> accordingly.
>
> It is a pity you have to do that. It would be nice if 'select line x of
fld y' had a [top | middle | bottom] option. Currently if you 'select line
15 of fld "my field"' regardless of the  number of soft wrapped lines, hard
line 15 will be scrolled to appear as the bottom visible line in your fld.
Why they didn't make it the top line I'm not sure as I'd think that more
useful, but still, having a choice would be nice. You can move your line to
the 2nd bottom line - line lineOffset() + 1, or 3rd bottom line - line
lineOffset() + 2, etc etc. and you can rough fudge it to the middle, but
you need the fomattedheight to get it to the top.

HTH



More information about the Use-livecode mailing list