Mark,
I'm restting it to 255 on mouseDown because of the method in which I've created the 
hiliting function, which includes SHIFTand CONTROL clicking and scrolling hilited 
lines. I've included the script below which was originally written by Dave Mennenoh 
(DSelect Parent Script V2.0). I've made changes, one of which sets the forecolor of 
the hilited lines to "0"

property spriteNum,hiliteList,hitLine,oldML,singleFlag
property lShowing,hiliteSprite1,lTotal,hiliterName
property linesAbove,linesBelow,multiLine,hiliteCount
global gControlKeyUsed

on new me,fieldNumber,fieldName,linesVisible,firstHiliter,mult
  spriteNum=fieldNumber
  hiliterName=fieldName
  lShowing=linesVisible
  hiliteSprite1=firstHiliter
  multiLine=mult
  hitLine=0
  oldML=0
  lTotal=the number of lines of sprite(spriteNum).member.text
  hiliteList=[]
  repeat with cnt=1 to lTotal
    hiliteList[cnt]=0 --no lines in the field are hilited to start
  end repeat
  hiliteCount=0
  sprite(spriteNum).member.scrollTop=0
  linesAbove=0 --the number of lines above the top of the field
  linesBelow=lTotal-lShowing --the number of lines below the bottom of the visible 
field
  --these two variables get adjusted by the scroll buttons
  return me
end

on clicked me
  hitLine=the mouseLine
  if the commandDown then
    gControlKeyUsed = TRUE
    oldML=hitLine
    singleFlag=2
    highlight(me)
    exit
  end if
  if the shiftDown then 
    singleFlag=0
    if oldML=0 then --shift being held on first click - make it a single click
      oldML=hitLine
    end if
  else
    singleFlag=1
    oldML=hitLine
  end if
  highlight(me)
end

on highLight me
  grayLineList =[]
  if multiLine<>1 then singleFlag=1
  if singleFlag=1 then --normal left click no buttons held down
    set the foreColor of field "AccountMastText" = 255
    
    repeat with cnt=1 to lTotal
      hiliteList[cnt]=0
    end repeat
    hiliteList[hitLine]=1
    hiliteCount=1
  else if singleFlag=2 then  --control key 
    if hiliteList[hitLine]=1 then
      hiliteCount=hiliteCount-1
    else
      hiliteCount=hiliteCount+1
    end if
    hiliteList[hitLine]=not hiliteList[hitLine]    
  else --shift key --first turn them all off then turn first to 2nd on
    repeat with cnt=1 to lTotal
      hiliteList[cnt]=0
    end repeat
    hiliteCount=0
    first=min(hitLine,oldML) --make sure first is before second for the
    second=max(hitLine,oldML)--repeat loop.
    repeat with cnt=first to second
      hiliteList[cnt]=1
      hiliteCount=hiliteCount+1
      set the foreColor of line cnt of member "AccountMastText" = 0
--      grayLineNumber = line cnt of member "AccountMastText"
--      append (grayLineList, grayLineNumber)
--      put grayLineList
    end repeat
  end if
  showHilites(me)
  
end

on showHilites me
  ind=0
  repeat with cnt=linesAbove+1 to linesAbove+lShowing
    sprite(hiliteSprite1+ind).visible=hiliteList[cnt]
    ind=ind+1
  end repeat
  set the foreColor of line hitLine of field "AccountMastText" = 0
end

on removeHilites me
  hitLine=0
  oldML=0
  repeat with cnt=1 to lTotal
    hiliteList[cnt]=0 
  end repeat
  hiliteCount=0
  showHilites(me)
end

on hideHilites me
  repeat with cnt=hiliteSprite1 to hiliteSprite1+lShowing-1
    sprite(cnt).visible=0
  end repeat
end

on isVisible me
  return sprite(spriteNum).visible
end

on scrollUp me
  if linesAbove>0 then --there's still lines above the top of the field
    scrollByLine sprite(spriteNum).member,-1 --scroll the field down for up arrow
    linesAbove=linesAbove-1 --one less line above
    linesBelow=linesBelow+1 --one more line below
    showHilites(me)
    updateStage
  end if
  startTicks=the Ticks --reset the timer
  lim=30 --wait .5 sec before quick scrolling
  repeat while the stillDown --if the button is being held down then auto scroll
    if the Ticks>startTicks+lim then --it's time to scroll
      if linesAbove>0 then 
        scrollByLine sprite(spriteNum).member,-1 
        linesAbove=linesAbove-1 
        linesBelow=linesBelow+1 
        showHilites(me)
        updateStage
        lim=3 --once we're quick scrolling only wait 3 ticks between moves
        startTicks=the Ticks --reset the timer
      end if
    end if
  end repeat
end

on scrollDown me
  if linesBelow>0 then
    scrollByLine sprite(spriteNum).member,1 --scroll the field up for Down arrow
    linesAbove=linesAbove+1
    linesBelow=linesBelow-1
    showHilites(me)
    updateStage
  end if
  startTicks=the Ticks
  lim=30
  repeat while the stillDown
    if the Ticks>startTicks+lim then
      if linesBelow>0 then
        scrollByLine sprite(spriteNum).member,1 --scroll the field up for Down arrow
        linesAbove=linesAbove+1
        linesBelow=linesBelow-1
        showHilites(me)
        updateStage
        lim=3
        startTicks=the Ticks
      end if
    end if
  end repeat
end

on scrollReset me
  hitLine=0
  oldML=0
  sprite(spriteNum).member.scrollTop=0
  linesAbove=0 --the number of lines above the top of the field
  linesBelow=lTotal-lShowing --the number of lines below the bottom of the visible 
field
  --these two variables get adjusted by the scroll buttons
  showHilites(me)
end

on returnSelectedList me
  selectedList=[]
  repeat with cnt=1 to hiliteList.count
    if hiliteList[cnt]=1 then
      append selectedList,member(hiliterName).text.line[cnt]
    end if
  end repeat
  if selectedList=[] then selectedList=-1 --return -1 if nothing is selected
  return selectedList
end


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to