struggle to use lineoffset

Jan Schenkel janschenkel at yahoo.com
Sat Jan 4 14:55:01 EST 2003


--- DVGlasgow at aol.com wrote:
> I have a field which following an assessment
> contains 56 lines, each with 4 
> chunks of data and a category identifier  (in word
> 5).  I want the user to 
> click on a line and all (8) of the lines containing
> data associated from the 
> same category to hilite. All 56 lines are unique, so
> i thought that having 
> extracted the category from the selectedline it
> would be easy to use 
> lineoffset to identify all the lines containing the
> category identifier. 
> 
>  But the script below doesn't work.  In fact, it
> doesn't seem to do anything. 
>  Debugging doesn't shed any light on what is going
> on - at least to me.
> 
> on mouseup
>   get  the selectedtext of me
>   put char 1 to 3 of word 5 of it into tcat
>   repeat for each line i in me
>     if i contains tcat then select line (lineoffset
> (i,me)) of me
>   end repeat
> end mouseup
> 
> The field is set up to allow multiple noncontiguous
> hilited lines.  
> Suggestions anyone?
> 
> Best wishes,
> 
> David Glasgow

Hi David,

In this case, wouldn't it be easier to keep track of
the linenumber you're checking, instead of using
lineoffset to go through the entire text every time?

on mouseup
  get  the selectedtext of me
  put char 1 to 3 of word 5 of it into tcat
  put 0 into j
  repeat for each line i in me
    add 1 to j
    if i contains tcat then select line j of me
  end repeat
end mouseup

Back to lineOffset now: if some lines are very much
alike one another, you may want to
  set the wholeMatches to true
before using lineOffset, to make sure you have the
correct line.

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the use-livecode mailing list