struggle to use lineoffset

Jan Schenkel janschenkel at yahoo.com
Mon Jan 6 07:44:01 EST 2003


--- DVGlasgow at aol.com wrote:
> 
> In a message dated 5/1/03 1:29:22 AM, Jan Schenkel.
> writes:
> 
> << 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. >>
> 
> Thanks Jan!
> 
> Your script goes straight in the old note book.  I
> have always just accepted 
> that the repeat for each structure didn't have a
> count built in - how obvious 
> that you can script one.
> 
> And thanks for the tip on lineoffset.  I discovered
> I needed  set the 
> hilitedline of me to empty just before the loop, or
> the line first clicked 
> was the only one in the category that was unhilited.
> 
> The other  interesting thing is the script *appears*
> to work, but actually 
> doesn't!  The hilites disappear (apart from the
> original) as soon as the 
> scrollbar is moved.  it also doesn't reliably hilite
> all instances if the 
> field is sorted by any chunk other than the one
> containing the category.  I 
> have switched the toggle hilites property a couple
> of times, but it doesn't 
> fix it.
> 
> Richard Gaskin's method produces stable
> noncontiguous hilites (Thanks once 
> again), but of course it only works the firt time
> through.  I hadn't 
> considered how I was going to unhilite the lines
> second and third time 
> through.  Maybe this shouldn't be a mouseup thing,
> doublemouseup would leave 
> mouseup to select a single line and  clear the
> multiple 
> selections.........hmmmm.  And so it goes....
> 
> 
> If anyone else has chipped in, I have only read the
> above so far, so TIA of 
> the usual multiple replies.
> 
> Best wishes,
> 
> David Glasgow

Hi David,

I forgot that the 'select' command is a bit quirky at
times. Try this version.

on mouseup
  get the value of the clickLine
  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 put j & comma after tLines
  end repeat
  if tLines is not empty then delete char -1 of tLines
  set the hilitedLines of me to tLines
end mouseup

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