 
 Glad you got it working!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
 
 Code: Select all
if tOffset > 0 then  -- I replaced 1 with 0
   add 1 to tOffset
end if
 
  
 Code: Select all
on mouseup
   
   ## What button did the user click:
   put the label of the target into tFirstChar
   
   ## Check if a City with that first character is in the list
   put lineOffset(CR & tFirstChar, CR & field "citylist") into tOffSet 
   ## FORGOT to also use ->  ...CR & field "citylist"), silly me :-)
   if tOffSet = 0 then
      beep 
      exit mouseup
   end if
   
   ## Success! Now scroll the first line starting with that character into view:
   set the scroll of field "citylist" to round(tOffSet * the effective textHeight of field "citylist")
   add 1 to tOffset
   set the hilitedlines of fld "citylist" to tOffSet
   set itemdel to TAB
   put item 2 of the selectedtext of fld "citylist" into tCode
   put tCode into field "CityCode"
end mouseup
