TOC hyperlinks to same field text below

J. Landman Gay jacque at hyperactivesw.com
Sat Mar 25 23:00:42 EST 2006


Sivakatirswami wrote:
> Given a field with a table of contents at the top how does one set  
> those links to jump the field down(up?) to the section, where the  text 
> includes one line paragraphs and the field is set to wrap? if  you use:
> 
> on linkclicked pLinkText
>   find pLinkText # need to skip the first instance which is the TOC  
> line itself
>   find pLinkText # go to the section in the body below.
> end linkclicked
> 
> 
> The results are erratic.

I use a trick. Use a script to put a non-typeable character, like 
numToChar(3) or numToChar(8), after the text you need to find. I do this 
with a temporary handler in the field:

on selectionchanged
   put numtochar(8) after the selection
end selectionchanged

Then I just click my way through the body of the text, adding invisible 
characters as I go.

Change the "find" command in the linkClicked handler so that it adds 
that character to the string to find, and use "find string":

on linkclicked pLinkText
  find string pLinkText & numToChar(8)
end linkclicked

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the Use-livecode mailing list