1. List with Quick Find?
- Posted by Tony Steward <figjam at nlc.net.au> Feb 06, 2001
- 387 views
Hi all, Some advise please! How would one go about having a list of text (sortedList) and creating a control at the bottom where a user can enter text. As the user enters text the list would scroll to the nearest match. soterdList Enter character "T" into search text & scroll to 1st item with "T" in it. Enter character "A" into text search & scroll to 1st item containing "TA". Preferable not case sensitive. Thanks Tony Steward Come visit me at www.locksdownunder.com
2. Re: List with Quick Find?
- Posted by David Cuny <dcuny at LANSET.COM> Feb 06, 2001
- 379 views
Tony Steward wrote: > How would one go about having a list of text > (sortedList) and creating a control at the bottom > where a user can enter text. As the user enters > text the list would scroll to the nearest match. The onChange event of the SearchText control is the place to put the hook. Try this (untested): procedure onChange_SearchText() integer index sequence text -- get the new text value text = getText( SearchText ) -- search the SortedList index = 0 for i = 1 to getCount( SortedList ) do if match( text, getItem( SortedList, i ) = 1 then -- found a match index = i elsif index then -- went too far exit end if end for -- set focus to last match setIndex( SortedList, index ) end procedure -- David Cuny
3. Re: List with Quick Find?
- Posted by David Cuny <dcuny at LANSET.COM> Feb 06, 2001
- 378 views
I had written: > procedure onChange_SearchText() Ooops. This is *probably* better (but still untested): procedure onChange_SearchText() sequence text -- get the new text value text = getText( SearchText ) -- search the SortedList for i = 1 to getCount( SortedList ) do if match( text, getItem( SortedList, i ) = 1 then setIndex( SortedList, i ) return end if end for -- no match setIndex( SortedList, 0 ) end procedure -- David Cuny