Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scrollByLine, scrollTop question

Status
Not open for further replies.

manfishj

Programmer
May 30, 2002
44
US
Hi,
I'm having trouble. The script below enables the
user to input a word, then click a button which will search a scrollable text field and then highlight the occurrence of the word that the user typed in. What I need it to do is, if this word is on a part of the text field
that is not visible, I need it to automatically scroll up or down to make the highlighted word visible. As someone suggested, it seems that I should use scrollByLine or scrollTop. However, I'm having trouble figuring out the conditions. How do I note which part of the text field is currently visible? Can anyone
steer me in the right direction? Thanks.
Jon

on mouseUp

wordSearch = member ("searchWord").text

pMemRef = sprite (4).member

tempStr = member("pMemRef").text

hiliteList = []

counter = 0

repeat while offset (wordSearch, tempStr)

startChar = offset (wordSearch, tempStr)

endChar = startChar + wordSearch.char.count - 1

hiliteList.append ([counter + startChar, counter + endChar])

delete char 1 to endChar of tempStr

counter = counter + endChar

end repeat
pMemRef.color = color (#rgb, 0, 0, 0)

repeat with i in hiliteList

pMemRef.char[i[1]..i[2]].color = color (#rgb, 255, 0, 0)

end repeat


end

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top