J. Landman Gay wrote:
Charles Hartman wrote:
I've modified Xavier's modification of my modification of
(somebody's??) code to search incrementally in a sorted list field.
Could it have been the one I posted about two years ago? I sent this to
the list:
local lUserKeys, lOldTicks
on keyDown whichKey -- select from keyboard
-- J. Landman Gay, 1990, modified for Revolution: 2003
if (the selectedField is not "") or (charToNum(whichKey) is among the
items of "28,29,30,31") -- arrow keys
then pass keyDown
if the ticks - lOldTicks > 60 then put "" into lUserKeys
put whichKey after lUserKeys
put return & fld "myField" & return into tListText
get lineoffset(cr&lUserKeys,tListText)
if it > 0 then set the hilitedline of fld "myField" to it
put the ticks into lOldTicks
end keyDown
But it doesn't solve one problem: suppose the user starts typing a
> string that doesn't appear in the list?
The easiest thing would be to just add a beep in this case, but if I
have time today I'll see if I can rewrite it to accomodate.
Is this closer? (Watch for line wrap):
local lUserKeys, lOldTicks
on keyDown whichKey -- select from keyboard
-- J. Landman Gay, 1990, modified for Revolution: 2003,
-- modifed for fuzzy selections 2005
if (the selectedField is not "") or (charToNum(whichKey) is among the
items of "28,29,30,31") -- arrow keys
then pass keyDown
if the ticks - lOldTicks > 60 then put "" into lUserKeys
put whichKey after lUserKeys
put return & fld 1 & return into tListText
get lineoffset(cr&lUserKeys,tListText)
if it = 0 and the number of chars in lUserKeys = 1 then
repeat until lineoffset(cr&lUserKeys,tListText) > 0
put charToNum(lUserKeys)+1 into tASCII
if tASCII > 122 then exit repeat -- maximum key is "Z"; adjust if
desired
put numToChar(tASCII) into lUserKeys
get lineoffset(cr&lUserKeys,tListText)
end repeat
if it = 0 then get the number of lines in fld 1
end if
if it = 0 then get the hilitedline of fld 1 -- multi-char string with
no match; leave alone
set the hilitedline of fld 1 to it
put the ticks into lOldTicks
end keyDown
--
Jacqueline Landman Gay | [EMAIL PROTECTED]
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution