:'Browse Lookup Auto Complete routine:'By Howard Wolowitz howiewz@earthlink.net (203) 270-7052: ::'Assumes that field 1 is a city name field.: ::'Uses filepro file "brwzip" to verify the users input: ::'*****************************************************************: :'***CHANGE FIELD NUMBER 'position to old city (if any):ky=1{"": :'*****************************************************************:: loop: 'force browse to fall through:pushkey "[entr]": dobrw::lookup zip = brwzip k=ky i=b -ex b="(brw=12,2,-1 show=keep fill=asc)[City ST Zip]*2 *3 *1 ": huh:not zip 'no match or user break key:goto skip: :zip(2) ne ky 'if no match make ky = last matched characters:w=zip(2); ky=mid(w,"1",len(ky)): :zip(2)=ky or ky="" 'show selected city:show ("20","30") "Enter City > "&zip(2): skip: 'but leave cursor after last typed good character:show ("20","30") "Enter City > "&ky: : 'we handle break:break off: : 'wait for key and save any @sk into sk (to allow debugger):a=waitkey; sk=@sk: : 'restore break to filepro:break on: ::'*****************************************************************: :sk="entr" '***CHANGE FIELD NUMBER 'one selected (pressed enter):1=zip(2): :'*****************************************************************:: :sk="brky" or sk="entr" 'user canceled or finished:clearb; cls("20","1"); END: :"|bs|clft|bksp|" co "|"&sk{"|" and len(ky) gt "0" 'handle backup:w=ky; ky=mid(w,"1",len(ky)-"1"); goto loop: :"|crup|cdwn|utab|dtab|" co "|"&sk&"|" 'allow some navigation keys:pushkey "["&sk&"]"; goto dobrw: :sk="home" 'handle home key:ky=""; goto huh: :len(a)="" 'no character - must be NG @sk - ignore:goto huh: : 'build potential new key to test:w=ky&a: : 'does new key match a record?:lookup zip = brwzip k=w i=b -nx: :zip 'yes, use it:ky=w: : 'reshow browse and get next character:goto loop: