Using an index field

David Squance dsquance at elkvalley.net
Wed Jan 26 22:56:35 EST 2005


On Jan 26, 2005, at 2:17 PM, Richard Gaskin wrote:

> David Squance wrote:
>> I've built a help stack for an app which consists mostly of two 
>> fields, one the content and the other an index.  Clicking on a line 
>> in the index takes the user to the appropriate section of the help 
>> contents.  It works fine when going 'down' the contents, but I'm 
>> wondering if there is a simple way for the user to avoid having to 
>> click twice to access any section which occurs earlier in the content 
>> than where the last found line occurs.
>
> I'n not sure how you code is setup, but I use a similar layout and 
> very simple supporting code.
>
> To fill the index list I just use:
>
>   put the cardnames of this stack into fld "index"
>
> To go to a card I have this in the "index" field script:
>
>   on mouseUp
>     go cd (the hilitedLine of me)
>   end mouseUp

Thanks for the reply.  The contents are a single field.  There's only 
one card, and the index field and contents field are about all there 
is.  Just a title and a 'put away' button.  The script for the index 
field is:

on mouseup
   put the value of the clickline into tFindText
   if  tFindText contains "overview" then find "overview" in fld 
"contents"
   else find whole tFindText in fld "contents"
end mouseup

The index is generated by hand.  It's not a big deal, but when the last 
foundchunk (or line) is somewhere in the middle or near the bottom and 
a line in the index field that is above the last one is clicked, 
nothing happens.  It takes a second click for it to do anything.  I was 
hoping there was a tip someone could offer to script around that.
Dave



More information about the use-livecode mailing list