FoxPro/Incremental search
Expert: Markish - 4/25/2008
Questionsir,
i am using foxpro2.6. Please give idea or coding about incremental search. i want to use it in my application
AnswerHi Ck,
VFP / Foxpro don't have an incremental search built-in. Still you can code it easily. I'll give you a direction, you build on it. In FoxPro 2.6, you've to code it completely. In the sense starting from displaying it, to select it and search it..
mkey=inkey()
do while mkey<>27 && Esc
mkey=0
do while mkey=0
mkey=inkey() && Captures the key pressed
enddo
do case
case mkey = 5 && Uparrow
skip -1
if bof()
go top
endif
** Write code here to display the appropriate record
case mkey = 24 && Downarrow
skip
if eof()
go bott
endif
** Write code here to display the appropriate record
case betw(mkey,65,90) or betw(mkey,97,122) or inli(mkey,46,127,32,64) or betw(mkey,33,57)
if mkey#127
if mkey#32
mfindstr=mfindstr+chr(mkey)
else
mfindstr=mfindstr+" "
endif
else
xx=mfindstr
if len(xx)>0
mfindstr=subs(xx,1,len(xx)-1)
else
?? chr(7)
endif
endif
mnam=mfindstr
xxxx=subs(Str(recn()+1000000,7),2,6)
loca for subs(upper(fname),1,len(mnam))=upper(mnam)
if found()
** Code here to highlight the found one...!
else
keyb chr(127)
?? chr(7)
&xxxx
endif
endcase
enddo
Hope this helps..
This is just a direction..
Best regards,
Markish