At 1:45 PM -0500 10/22/02, you wrote:
The code below works for me. (& pretty quickly)I'm having a great deal of trouble getting a dictionary to work correctly.Here's the scenario... Text cast members at the top of the screen representing the alphabet. User clicks on a letter. A field cast member on the screen then jumps to the first line whose first character matches the letter they've clicked on. I tried a repeat loop that went thru the entire field cast member, but it takes forever and the end result is that it doesn't scroll to the line I need. How does one find the first line in a field that matches the letter the user has clicked on?
And if you field is so large that you're getting huge delays, then I'd suggest breaking the dictionary up into several field members (& expand the case statement near the top to include other fields)
on scrollToLetter letter
which = offset(letter,"aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ")
put which
case TRUE of
(which > 0) : f = member("field")
end case
t = f.text
num = t.line.count
repeat with i = 1 to num
if t.line[i].char[1] = letter then exit repeat
end repeat
if i <> num+1 then f.scrollbyline(-num) --reset to the top
f.scrollbyline(i-1) -- scroll to the line
end if
end
this should work as the field if it's not Adjust to Fit
hth
-Buzz
Sharon Moeller
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/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!]
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/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!]
