Implementation of "Filter with:" and " Scroll to:"
sarahr at genesearch.com.au
Tue Oct 8 01:42:05 EDT 2002
The docs use 2 types: search which scrolls to the first matching entry
and filter which only shows matching entries:
If you want the scroll method and you have your list in a field called
"List" then your search field needs a script like this:
if me is empty then -- scroll back to top
set the hilitedLines of field "List" to 1
put lineOffset(return & me, field "List") + 1 into currentLine
if currentLine > 1 then
set the hilitedLines of field "List" to currentLine
set the scroll of field "List" to \
(currentLine - 1) * the effective textHeight of field "List"
The main trick with the filter method is that "filter" is destructive,
so you need to store the complete list somewhere invisible, like in a
custom property of the field. Suppose you have your display field
"List" and that field has a custom property called completeList.
In your filter field, you need the following script:
put the completeList of fld "List" into theList
filter theList with "*" & me & "*"
put theList into fld "List"
The *'s on either side allow you to find the specified text even if it
is in the middle of a line. If you wanted to find only to find text
that matched the beginnings of lines, you could leave out the first "*".
As you say, both these methods are very fast.
On Tuesday, October 8, 2002, at 09:07 am, Mike Doub wrote:
> Hello all,
> I am new to transcription programming and am looking to implement a
> mechanism similar to that that is illustrated in the Revolution
> Documentation stack in the Transcript Language Dictionary. I like the
> fast positioning within the field with every keystroke. Can anyone
> tell me
> how this might be implemented?
> use-revolution mailing list
> use-revolution at lists.runrev.com
More information about the Use-livecode