scrolling to a line

Charles Hartman charles.hartman at conncoll.edu
Sun Nov 13 22:57:59 EST 2005


Hmm! I think that might do it. Thanks!

I thought of that general approach (hadn't gotten the details worked  
out) -- but I guess I was thinking there might be a way to, in  
effect, intervene in the operations of lineOffset: to tell it, no no  
you just went one too far . . . Silly, I suppose. I could write a  
binary-search substitute for lineOffset . . . That's sillier. I think  
you probably have the best approach.

Thanks again. I'll try it out tomorrow.

Charles Hartman

On Nov 13, 2005, at 10:40 PM, J. Landman Gay wrote:

> 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         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list