Hi Peter, Many thanks for posting this handler. Filtering the search results is a great idea! Thanks again.
Looks like your handler was cut-off, because the rawKeydown handler does not had a closing match. While running this handler, i always get the word "sEntryBuffer" in the field "enterPt" and could not erase the content using backspace or delete keys. Obviously, i am doing something wrong. Could you point me where is my error? Notice that to run this handler i created a global named pList that contains the names list and changed the part of the script where it reads "ptList": put ptList into selectedPts (changed to:) put pList into selectedPts Thanks in advance. Alejandro Peter Brigham MD wrote: > > > I modified your code to include filtering the displayed list. Works > like a charm, very elegant. Great timing, too, since your solution met > a need I just discovered I had.... > Note comments marked with --## > (watch line wraps) > > # match name as user types > on rawKeyDown pWhich > if the commandKey is down then pass rawKeyDown > # exclude any functions like copy, paste, etc. > if pWhich <= 255 then # for anything that's in ascii range > put the selectedChunk into tSelChunk > if word 2 of tSelChunk <= word 4 of tSelChunk then > # adding a char to the end of the entry buffer > put sEntryBuffer & numToChar(pWhich) into sEntryBuffer > else # inserting a char inside the entry buffer > put numToChar(pWhich) after char word 4 of tSelChunk of > sEntryBuffer > put sEntryBuffer into fld "enterPt" > end if > --## I added the following two lines > --## pList is a global containing the full list of names > put pList into selectedPts > filter selectedPts with sEntryBuffer & "*" > --## now selectedPts contains only those entries that match > --## this shortens & simplifies the display list > put lineOffset(cr & sEntryBuffer, cr & selectedPts) into > currentLine > if currentLine > 0 then > put selectedPts into fld "pList" > --## instead of putting the whole list into the field > showUserList > set the hilitedLines of field "pList" to currentLine > set the scroll of field "pList" to \ > (currentLine - 1) * the effective textHeight of field "pList" > put the selectedText of fld "pList" into fld "enterPt" > select char (word 2 of tSelChunk) + 1 to -1 of fld "enterPt" > else > hide fld "pList" > set the hilitedline of fld "pList" to 0 > put sEntryBuffer into fld "enterPt" > select after char word 4 of tSelChunk + 1 of fld "enterPt" > end if > else # handle all other keys > > -- Peter > -- View this message in context: http://www.nabble.com/Autocomplete-field-tp26098204p26123877.html Sent from the Revolution - User mailing list archive at Nabble.com. _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
