How to create a hyperlink within a text field?

Peter Brigham pmbrig at gmail.com
Wed Feb 3 17:58:09 CET 2016


Two ways to do it. The first and simplest is to lock the screen and do 2
finds in succession, as you suggested. The second is to get the lineoffsets
of the link text and scroll to the second occurrence of it. 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.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig


On Wed, Feb 3, 2016 at 8:39 AM, Tiemo Hollmann TB <toolbook at kestner.de>
wrote:

> Alternativly I also tried to work with lineOffset and setting the vScoll of
> the field. The lineOffset gives me the number of the found textline, but
> not
> the visible line number of a scrolling field with word wrap, which can be
> resized. In such a field the "effective" line number can vary, depending on
> the current size of the field.
> Is there anything such as the "effective lineOffset", or even better a
> direct approach to scroll to the found chunck? Probably I don't see the
> obvious.
> Tiemo
>
> -----Ursprüngliche Nachricht-----
> Von: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] Im
> Auftrag
> von Tiemo Hollmann TB
> Gesendet: Mittwoch, 3. Februar 2016 12:07
> An: LiveCode User Liste senden <use-livecode at lists.runrev.com>
> Betreff: How to create a hyperlink within a text field?
>
> Hello,
>
> just not to invent the wheel again. I have a long text field with a table
> of
> contents at the beginning and headlines for chapters and I would like to
> make the table of content clickable as hyperlinks, so that the user is
> forwarded to the wanted chapter in the same field.
>
> I can set the textstyle of each chapter in the table of content to "link"
> and handle the  click in "on linkClicked pLink", no problem about that.
>
> The question is, how to handle the field scrolling to the wanted chapter
> headline after clicking on the hyperlink. When using "find whole pLink in
> the target", the find command finds first the chapter headline in the table
> of content and stops at the top. I could cheat this, by doubleing the find
> command, so that the second find command goes on searching and finds the
> real chapter headline and scrolls the field to the wanted chapter.
>
> But I think that there must be a more straight forward way to realize this
> kind of hyperlink.
>
> Thanks
>
> Tiemo
>
>
>
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


More information about the use-livecode mailing list